American Standard Code for Information Interchange (ASCII)
The
American Standard Code for Information Interchange
(ASCII) is a character encoding scheme, first published as a standard in 1967
by the
American Standards Association
(ASA), that is used to encode alpha-numeric, puctuation and non-printing
control characters using an eight-bit byte to represent each character. Seven
of the bits are used to represent the character itself, giving a range of 128
characters. The additional bit is a parity bit that provides a simple error
detection mechanism. Different standards bodies and corporations have developed
variations of ASCII to accomodate languages other than English that use the
Latin alphabet.
Unicode
, a modern character encoding scheme that provides a unique number for any
character regardless of the computing platform or language used, assigns the
same encoding as ASCII to the characters represented in the ASCII character set
to ensure backward compatibility. There are 33 non-printing characters (0-31,
and 127) and 95 printable ASCII characters (32-126). The digits 0-9 are
represented using their 4-bit binary value, prefixed with 0011. Lower and upper
case letters differ only by a single bit, which simplifies conversion from
upper to lower case and vice versa. The standard ASCII character set is shown
below.
| ASCII Codes | |||||
| Decimal | Hex | Char | Decimal | Hex | Char |
| 0 | 0 | NUL | 64 | 40 | @ |
| 1 | 1 | SOH | 65 | 41 | A |
| 2 | 2 | STX | 66 | 42 | B |
| 3 | 3 | ETX | 67 | 43 | C |
| 4 | 4 | EOT | 68 | 44 | D |
| 5 | 5 | ENQ | 69 | 45 | E |
| 6 | 6 | ACK | 70 | 46 | F |
| 7 | 7 | BEL | 71 | 47 | G |
| 8 | 8 | BS | 72 | 48 | H |
| 9 | 9 | HT | 73 | 49 | I |
| 10 | A | LF | 74 | 4A | J |
| 11 | B | VT | 75 | 4B | K |
| 12 | C | FF | 76 | 4C | L |
| 13 | D | CR | 77 | 4D | M |
| 14 | E | SO | 78 | 4E | N |
| 15 | F | SI | 79 | 4F | O |
| 16 | 10 | DLE | 80 | 50 | P |
| 17 | 11 | DC1 | 81 | 51 | Q |
| 18 | 12 | DC2 | 82 | 52 | R |
| 19 | 13 | DC3 | 83 | 53 | S |
| 20 | 14 | DC4 | 84 | 54 | T |
| 21 | 15 | NAK | 85 | 55 | U |
| 22 | 16 | SYN | 86 | 56 | V |
| 23 | 17 | ETB | 87 | 57 | W |
| 24 | 18 | CAN | 88 | 58 | X |
| 25 | 19 | EM | 89 | 59 | Y |
| 26 | 1A | SUB | 90 | 58 | Z |
| 27 | 1B | ESC | 91 | 5B | [ |
| 28 | 1C | FS | 92 | 5C | \ |
| 29 | 1D | GS | 93 | 5D | ] |
| 30 | 1E | RS | 94 | 5E | ^ |
| 31 | 1E | RS | 94 | 5F | _ |
| 32 | 20 | SP | 96 | 60 | ` |
| 33 | 21 | ! | 97 | 61 | a |
| 34 | 22 | " | 98 | 62 | b |
| 35 | 23 | # | 99 | 63 | c |
| 36 | 24 | $ | 100 | 64 | d |
| 37 | 25 | % | 101 | 65 | e |
| 38 | 26 | & | 102 | 66 | f |
| 39 | 27 | ' | 103 | 67 | g |
| 40 | 28 | ( | 104 | 68 | h |
| 41 | 29 | ) | 105 | 69 | i |
| 42 | 2A | * | 106 | 6A | j |
| 43 | 2B | + | 107 | 6B | k |
| 44 | 2C | , | 108 | 6C | l |
| 45 | 2D | - | 109 | 6D | m |
| 46 | 2E | . | 110 | 6E | n |
| 47 | 2F | / | 111 | 6F | o |
| 48 | 30 | 0 | 112 | 70 | p |
| 49 | 31 | 1 | 113 | 71 | q |
| 50 | 32 | 2 | 114 | 72 | r |
| 51 | 33 | 3 | 115 | 73 | s |
| 52 | 34 | 4 | 116 | 74 | t |
| 53 | 35 | 5 | 117 | 75 | u |
| 54 | 36 | 6 | 118 | 76 | v |
| 55 | 37 | 7 | 119 | 77 | w |
| 56 | 38 | 8 | 120 | 78 | x |
| 57 | 39 | 9 | 121 | 79 | y |
| 58 | 3A | : | 122 | 7A | z |
| 59 | 3B | ; | 123 | 7B | { |
| 60 | 3C | < | 124 | 7C | | |
| 61 | 3D | = | 125 | 7D | } |
| 62 | 3E | > | 126 | 7E | ~ |
| 63 | 3F | ? | 127 | 7F | DEL |
The first 32 ASCII characters are non-printing control characters, the original
purpose of which was to control devices such as printers. The following table
provides a brief description for each of these control codes.
| ASCII Control Codes | |||
| Decimal | Hex | Char | Description |
| 0 | 0 | NUL | Null Character |
| 1 | 1 | SOH | Start of Header |
| 2 | 2 | STX | Start of Text |
| 3 | 3 | ETX | End of Text |
| 4 | 4 | EOT | End of Transmission |
| 5 | 5 | ENQ | Enquiry |
| 6 | 6 | ACK | Acknowledgement |
| 7 | 7 | BEL | Bell - causes a beep in most computer terminals |
| 8 | 8 | BS | Backspace - causes the cursor to move back one space |
| 9 | 9 | HT | Horizontal Tab - moves the cursor right to the next tab stop |
| 10 | A | LF | Line Feed - moves the cursor to a new line |
| 11 | B | VT | Vertical Tab |
| 12 | C | FF | Form Feed - advances paper to the top of the next page (if output device is a printer) |
| 13 | D | CR | Carriage Return - moves the cursor to the left but does not advance to the next line |
| 14 | E | SO | Shift Out - switches output device to alternate character set |
| 15 | F | SI | Shift In - switches output device back to default character set |
| 16 | 10 | DLE | Data Link Escape |
| 17 | 11 | DC1 | Device Control 1 (XON) |
| 18 | 12 | DC2 | Device Control 2 |
| 19 | 13 | DC3 | Device Control 3 (XOFF) |
| 20 | 14 | DC4 | Device Control 4 |
| 21 | 15 | NAK | Negative Acknowledgement |
| 22 | 16 | SYN | Synchronous Idle |
| 23 | 17 | ETB | End of Transmission Block |
| 24 | 18 | CAN | Cancel |
| 25 | 19 | EM | End of Medium |
| 26 | 1A | SUB | Substitute |
| 27 | 1B | ESC | Escape |
| 28 | 1C | FS | File Separator |
| 29 | 1D | GS | Group Separator |
| 30 | 1E | RS | Record Separator |
| 31 | 1F | US | Unit Separator |