The Complete Guide to ASCII: History, Encoding Principles, and Full Character Table
A comprehensive guide to ASCII encoding — its origins, how it works, character classification, and the full lookup table. Understand control characters vs. printable characters and ASCII's role in modern computing. Includes an online ASCII converter tool.
In everyday programming and data processing, ASCII is one of the very first character encoding standards we encounter — and one of the most frequently used. Whether you’re naming variables in code, parsing network protocol messages, or debugging serial communication in embedded systems, ASCII is the bedrock of it all. This article covers everything from its historical origins to encoding principles, character classifications, and full lookup tables.
Need to convert between ASCII codes and text right now? Try our Online ASCII Converter, which supports decimal, binary, octal, and hexadecimal formats.
1. What is ASCII?
ASCII (American Standard Code for Information Interchange) is a character encoding system based on the Latin alphabet. First published in 1963 by the American Standards Association (ASA, later ANSI), it is the ancestor of all modern character encoding systems.
ASCII uses 7-bit binary numbers (ranging from 0000000 to 1111111) to represent 128 characters, including:
- 33 control characters (non-printable, codes 0–31 and 127)
- 95 printable characters (codes 32–126), covering English letters, Arabic numerals, punctuation marks, and various special symbols
Since 7 bits fit neatly into an 8-bit byte (with the high bit typically set to 0 or used for parity checking), ASCII is naturally aligned with the byte-based storage architecture of computers.
2. The History of ASCII
2.1 The Problem It Solved
Before the 1960s, different computer manufacturers defined their own character encodings. IBM used EBCDIC, telegraph systems used Baudot code, and these were mutually incompatible. This made cross-platform data exchange extremely difficult.
To create a unified standard, the American Standards Association (ASA) began work on ASCII in 1960. The ASA X3.4 standard — ASCII — was officially published in 1963.
2.2 Key Milestones
| Year | Event |
|---|---|
| 1963 | ASCII first published (ASA X3.4-1963) with 128 characters |
| 1967 | Revised edition released, adding lowercase letters and other updates |
| 1968 | U.S. federal government mandated ASCII support for all government computers |
| 1986 | Final revision (ANSI X3.4-1986), the version still in use today |
| 1991 | Unicode 1.0 released; ASCII becomes a subset of Unicode (U+0000 to U+007F) |
2.3 From ASCII to Unicode
ASCII can only represent 128 characters — sufficient for English but unable to cover Chinese, Japanese, Korean, Arabic, and countless other writing systems. To meet globalization needs, various extended encodings were developed (ISO 8859 series, GBK, Shift-JIS, etc.), and eventually Unicode emerged as today’s universal character encoding standard.
Notably, ASCII is a proper subset of UTF-8 — any ASCII text is already valid UTF-8 text. This backward compatibility is one of the key reasons UTF-8 has been adopted so rapidly.
3. How ASCII Encoding Works
3.1 Binary Representation
Each ASCII character is represented by a 7-bit binary number, with values ranging from 0 to 127. Take the letter A as an example:
- Decimal: 65
- Binary:
1000001 - Octal:
101 - Hexadecimal:
41
3.2 Encoding Example
Let’s convert the word Hello to ASCII decimal codes:
| Character | H | e | l | l | o |
|---|---|---|---|---|---|
| Decimal | 72 | 101 | 108 | 108 | 111 |
| Hexadecimal | 48 | 65 | 6C | 6C | 6F |
| Binary | 1001000 | 1100101 | 1101100 | 1101100 | 1101111 |
So the ASCII decimal representation of Hello is 72 101 108 108 111.
You can verify this using our Online ASCII Converter, which supports bidirectional conversion between text and ASCII codes.
3.3 Clever Design Patterns
ASCII’s code assignments are far from arbitrary — they contain several elegant design choices:
- Uppercase and lowercase letters differ by 32:
A= 65,a= 97 — the difference is exactly 32 (only bit 5 differs). This means you can convert case by flipping a single bit. - Digit characters follow a pattern:
0= 48 (0x30),9= 57 (0x39). Subtracting 48 (or'0') from a digit character gives you its numeric value. - Letters are arranged consecutively: A–Z and a–z are contiguous in the encoding table, making iteration and arithmetic straightforward.
- Control characters come first: Codes 0–31 are reserved for control functions; printable characters start at 32.
4. ASCII Character Classification
4.1 Control Characters (0–31, 127)
Control characters do not display visible glyphs on screen. Instead, they control how text is processed. Here are some commonly encountered ones:
| Decimal | Hex | Abbr. | Name | Description |
|---|---|---|---|---|
| 0 | 00 | NUL | Null | String terminator (C language \0) |
| 7 | 07 | BEL | Bell | Triggers a terminal bell/beep |
| 8 | 08 | BS | Backspace | Moves cursor back one position |
| 9 | 09 | HT | Horizontal Tab | Tab key (\t) |
| 10 | 0A | LF | Line Feed | New line (\n), Unix/Linux line ending |
| 13 | 0D | CR | Carriage Return | Return to start of line (\r), Windows uses CR+LF |
| 27 | 1B | ESC | Escape | Start of terminal escape sequences |
| 127 | 7F | DEL | Delete | Delete character |
Fun fact: The difference in line endings across operating systems is a classic headache. Unix/Linux uses
LF(\n), Windows usesCR LF(\r\n), and classic Mac OS usedCR(\r).
4.2 Printable Characters (32–126)
Printable characters are what we use most frequently — spaces, punctuation, digits, and letters.
Digits (48–57)
| Decimal | Char | Decimal | Char | Decimal | Char |
|---|---|---|---|---|---|
| 48 | 0 | 52 | 4 | 56 | 8 |
| 49 | 1 | 53 | 5 | 57 | 9 |
| 50 | 2 | 54 | 6 | ||
| 51 | 3 | 55 | 7 |
Uppercase Letters (65–90)
| Decimal | Char | Decimal | Char | Decimal | Char |
|---|---|---|---|---|---|
| 65 | A | 74 | J | 83 | S |
| 66 | B | 75 | K | 84 | T |
| 67 | C | 76 | L | 85 | U |
| 68 | D | 77 | M | 86 | V |
| 69 | E | 78 | N | 87 | W |
| 70 | F | 79 | O | 88 | X |
| 71 | G | 80 | P | 89 | Y |
| 72 | H | 81 | Q | 90 | Z |
| 73 | I | 82 | R |
Lowercase Letters (97–122)
| Decimal | Char | Decimal | Char | Decimal | Char |
|---|---|---|---|---|---|
| 97 | a | 106 | j | 115 | s |
| 98 | b | 107 | k | 116 | t |
| 99 | c | 108 | l | 117 | u |
| 100 | d | 109 | m | 118 | v |
| 101 | e | 110 | n | 119 | w |
| 102 | f | 111 | o | 120 | x |
| 103 | g | 112 | p | 121 | y |
| 104 | h | 113 | q | 122 | z |
| 105 | i | 114 | r |
4.3 Complete ASCII Reference Table (0–127)
Here is the full set of all 128 standard ASCII characters:
Control Characters (0–31 and 127)
| Decimal | Octal | Hex | Binary | Abbr. | Name | Description |
|---|---|---|---|---|---|---|
| 0 | 000 | 00 | 0000000 | NUL | Null | String terminator (C language \0) |
| 1 | 001 | 01 | 0000001 | SOH | Start of Heading | Data frame start marker |
| 2 | 002 | 02 | 0000010 | STX | Start of Text | Body data start |
| 3 | 003 | 03 | 0000011 | ETX | End of Text | Body data end |
| 4 | 004 | 04 | 0000100 | EOT | End of Transmission | Terminate transmission |
| 5 | 005 | 05 | 0000101 | ENQ | Enquiry | Request response |
| 6 | 006 | 06 | 0000110 | ACK | Acknowledge | Data received confirmation |
| 7 | 007 | 07 | 0000111 | BEL | Bell | Triggers a terminal bell/beep |
| 8 | 010 | 08 | 0001000 | BS | Backspace | Moves cursor back one position |
| 9 | 011 | 09 | 0001001 | HT | Horizontal Tab | Tab key (\t) |
| 10 | 012 | 0A | 0001010 | LF | Line Feed | New line (\n), Unix/Linux line ending |
| 11 | 013 | 0B | 0001011 | VT | Vertical Tab | Vertical tabulation |
| 12 | 014 | 0C | 0001100 | FF | Form Feed | Next page (\f) |
| 13 | 015 | 0D | 0001101 | CR | Carriage Return | Return to start of line (\r) |
| 14 | 016 | 0E | 0001110 | SO | Shift Out | Switch to alternate character set |
| 15 | 017 | 0F | 0001111 | SI | Shift In | Switch back to original character set |
| 16 | 020 | 10 | 0010000 | DLE | Data Link Escape | Escape control character |
| 17 | 021 | 11 | 0010001 | DC1 | Device Control 1 | XON (resume transmission) |
| 18 | 022 | 12 | 0010010 | DC2 | Device Control 2 | Device-specific control |
| 19 | 023 | 13 | 0010011 | DC3 | Device Control 3 | XOFF (pause transmission) |
| 20 | 024 | 14 | 0010100 | DC4 | Device Control 4 | Device-specific control |
| 21 | 025 | 15 | 0010101 | NAK | Negative Acknowledge | Reject/error |
| 22 | 026 | 16 | 0010110 | SYN | Synchronous Idle | Synchronization signal |
| 23 | 027 | 17 | 0010111 | ETB | End of Transmission Block | Data block end marker |
| 24 | 030 | 18 | 0011000 | CAN | Cancel | Cancel current operation |
| 25 | 031 | 19 | 0011001 | EM | End of Medium | Data medium end |
| 26 | 032 | 1A | 0011010 | SUB | Substitute | Replacement for unavailable character |
| 27 | 033 | 1B | 0011011 | ESC | Escape | Start of terminal escape sequences |
| 28 | 034 | 1C | 0011100 | FS | File Separator | File separator |
| 29 | 035 | 1D | 0011101 | GS | Group Separator | Group separator |
| 30 | 036 | 1E | 0011110 | RS | Record Separator | Record separator |
| 31 | 037 | 1F | 0011111 | US | Unit Separator | Unit separator |
| 127 | 177 | 7F | 1111111 | DEL | Delete | Delete character |
Space and Punctuation (32–47)
| Decimal | Octal | Hex | Char | Name |
|---|---|---|---|---|
| 32 | 040 | 20 | | Space |
| 33 | 041 | 21 | ! | Exclamation mark |
| 34 | 042 | 22 | " | Double quotation mark |
| 35 | 043 | 23 | # | Number sign |
| 36 | 044 | 24 | $ | Dollar sign |
| 37 | 045 | 25 | % | Percent sign |
| 38 | 046 | 26 | & | Ampersand |
| 39 | 047 | 27 | ' | Apostrophe |
| 40 | 050 | 28 | ( | Left parenthesis |
| 41 | 051 | 29 | ) | Right parenthesis |
| 42 | 052 | 2A | * | Asterisk |
| 43 | 053 | 2B | + | Plus sign |
| 44 | 054 | 2C | , | Comma |
| 45 | 055 | 2D | - | Hyphen-minus |
| 46 | 056 | 2E | . | Full stop |
| 47 | 057 | 2F | / | Slash |
Digits (48–57)
| Decimal | Octal | Hex | Char | Name |
|---|---|---|---|---|
| 48 | 060 | 30 | 0 | Digit zero |
| 49 | 061 | 31 | 1 | Digit one |
| 50 | 062 | 32 | 2 | Digit two |
| 51 | 063 | 33 | 3 | Digit three |
| 52 | 064 | 34 | 4 | Digit four |
| 53 | 065 | 35 | 5 | Digit five |
| 54 | 066 | 36 | 6 | Digit six |
| 55 | 067 | 37 | 7 | Digit seven |
| 56 | 070 | 38 | 8 | Digit eight |
| 57 | 071 | 39 | 9 | Digit nine |
Punctuation (58–64)
| Decimal | Octal | Hex | Char | Name |
|---|---|---|---|---|
| 58 | 072 | 3A | : | Colon |
| 59 | 073 | 3B | ; | Semicolon |
| 60 | 074 | 3C | < | Less-than sign |
| 61 | 075 | 3D | = | Equals sign |
| 62 | 076 | 3E | > | Greater-than sign |
| 63 | 077 | 3F | ? | Question mark |
| 64 | 100 | 40 | @ | At sign |
Uppercase Letters (65–90)
| Decimal | Octal | Hex | Char | Name |
|---|---|---|---|---|
| 65 | 101 | 41 | A | Uppercase A |
| 66 | 102 | 42 | B | Uppercase B |
| 67 | 103 | 43 | C | Uppercase C |
| 68 | 104 | 44 | D | Uppercase D |
| 69 | 105 | 45 | E | Uppercase E |
| 70 | 106 | 46 | F | Uppercase F |
| 71 | 107 | 47 | G | Uppercase G |
| 72 | 110 | 48 | H | Uppercase H |
| 73 | 111 | 49 | I | Uppercase I |
| 74 | 112 | 4A | J | Uppercase J |
| 75 | 113 | 4B | K | Uppercase K |
| 76 | 114 | 4C | L | Uppercase L |
| 77 | 115 | 4D | M | Uppercase M |
| 78 | 116 | 4E | N | Uppercase N |
| 79 | 117 | 4F | O | Uppercase O |
| 80 | 120 | 50 | P | Uppercase P |
| 81 | 121 | 51 | Q | Uppercase Q |
| 82 | 122 | 52 | R | Uppercase R |
| 83 | 123 | 53 | S | Uppercase S |
| 84 | 124 | 54 | T | Uppercase T |
| 85 | 125 | 55 | U | Uppercase U |
| 86 | 126 | 56 | V | Uppercase V |
| 87 | 127 | 57 | W | Uppercase W |
| 88 | 130 | 58 | X | Uppercase X |
| 89 | 131 | 59 | Y | Uppercase Y |
| 90 | 132 | 5A | Z | Uppercase Z |
Brackets and Backtick (91–96)
| Decimal | Octal | Hex | Char | Name |
|---|---|---|---|---|
| 91 | 133 | 5B | [ | Left square bracket |
| 92 | 134 | 5C | \ | Backslash |
| 93 | 135 | 5D | ] | Right square bracket |
| 94 | 136 | 5E | ^ | Circumflex accent |
| 95 | 137 | 5F | _ | Underscore |
| 96 | 140 | 60 | ` | Grave accent (backtick) |
Lowercase Letters (97–122)
| Decimal | Octal | Hex | Char | Name |
|---|---|---|---|---|
| 97 | 141 | 61 | a | Lowercase a |
| 98 | 142 | 62 | b | Lowercase b |
| 99 | 143 | 63 | c | Lowercase c |
| 100 | 144 | 64 | d | Lowercase d |
| 101 | 145 | 65 | e | Lowercase e |
| 102 | 146 | 66 | f | Lowercase f |
| 103 | 147 | 67 | g | Lowercase g |
| 104 | 150 | 68 | h | Lowercase h |
| 105 | 151 | 69 | i | Lowercase i |
| 106 | 152 | 6A | j | Lowercase j |
| 107 | 153 | 6B | k | Lowercase k |
| 108 | 154 | 6C | l | Lowercase l |
| 109 | 155 | 6D | m | Lowercase m |
| 110 | 156 | 6E | n | Lowercase n |
| 111 | 157 | 6F | o | Lowercase o |
| 112 | 160 | 70 | p | Lowercase p |
| 113 | 161 | 71 | q | Lowercase q |
| 114 | 162 | 72 | r | Lowercase r |
| 115 | 163 | 73 | s | Lowercase s |
| 116 | 164 | 74 | t | Lowercase t |
| 117 | 165 | 75 | u | Lowercase u |
| 118 | 166 | 76 | v | Lowercase v |
| 119 | 167 | 77 | w | Lowercase w |
| 120 | 170 | 78 | x | Lowercase x |
| 121 | 171 | 79 | y | Lowercase y |
| 122 | 172 | 7A | z | Lowercase z |
Braces and Tilde (123–126)
| Decimal | Octal | Hex | Char | Name |
|---|---|---|---|---|
| 123 | 173 | 7B | { | Left curly bracket |
| 124 | 174 | 7C | ` | ` |
| 125 | 175 | 7D | } | Right curly bracket |
| 126 | 176 | 7E | ~ | Tilde |
5. ASCII in Programming
5.1 Converting Between Characters and Codes
Most programming languages make it easy to convert between characters and their ASCII values:
JavaScript:
// Character → ASCII code
'A'.charCodeAt(0); // 65
// ASCII code → Character
String.fromCharCode(65); // 'A'
Python:
# Character → ASCII code
ord('A') # 65
# ASCII code → Character
chr(65) # 'A'
C:
// Characters are integers
char c = 'A';
int ascii = c; // 65
// Integer to character
char ch = 65; // 'A'
5.2 Case Conversion Tricks
Since uppercase and lowercase ASCII letters differ by exactly 32, you can use bitwise operations for efficient case conversion:
// To lowercase: set bit 5 to 1 (OR 32)
String.fromCharCode('A'.charCodeAt(0) | 32); // 'a'
// To uppercase: set bit 5 to 0 (AND ~32)
String.fromCharCode('a'.charCodeAt(0) & ~32); // 'A'
// Toggle case: flip bit 5 (XOR 32)
String.fromCharCode('A'.charCodeAt(0) ^ 32); // 'a'
5.3 Data Validation and Protocols
Many network protocols (HTTP, SMTP, FTP) use ASCII text for commands and headers. Understanding ASCII helps you parse network messages, debug serial communication, and understand percent-encoding in URLs — like %20 (space) or %41 (A).
6. ASCII Extensions and Unicode
6.1 Limitations of ASCII
128 characters are barely enough for English, but they fall short when facing hundreds of languages and tens of thousands of writing systems worldwide:
- Cannot represent accented European characters (é, ü, ñ)
- Does not support CJK (Chinese, Japanese, Korean) characters
- Lacks many mathematical and special symbols
6.2 Extended ASCII
To compensate, various vendors used the 8th bit (codes 128–255) to define “Extended ASCII” character sets:
- ISO 8859-1 (Latin-1): Covers Western European languages
- Windows-1252: Microsoft’s Western European character set
- GB2312 / GBK: Chinese character encodings
- Shift-JIS: Japanese character encoding
These extensions were mutually incompatible, leading to the infamous “mojibake” (garbled text) problem.
6.3 Unicode Unification
Unicode preserves ASCII’s 0–127 at U+0000 to U+007F and extends coverage to over 150,000 characters. UTF-8 is fully backward-compatible with ASCII: for characters in the ASCII range (0–127), UTF-8 uses the exact same single-byte encoding. This is why UTF-8 has become the default encoding for most modern systems.
7. ASCII Art
ASCII art is the practice of creating images and patterns using ASCII printable characters. In the early days of computing and BBS (Bulletin Board Systems), ASCII art was one of the primary ways to display graphics.
/\_/\
( o.o )
> ^ <
/| |\
(_| |_)
ASCII art remains alive and well in programmer culture today — many command-line tools and open-source projects display carefully designed ASCII logos on startup.
8. Frequently Asked Questions
Q1: What is the relationship between ASCII and Unicode?
ASCII is a subset of Unicode. The first 128 code points of Unicode (U+0000 to U+007F) are identical to ASCII.
Q2: How many characters does ASCII have?
Standard ASCII defines 128 characters (7-bit, 0–127): 33 control characters and 95 printable characters.
Q3: Does ASCII support Chinese characters?
No. Chinese characters are outside the standard ASCII range. Chinese text uses extended character sets (like GBK or GB18030) or Unicode encoding.
Q4: Why does ASCII use 7 bits instead of 8?
At the time of its design, 7 bits were sufficient to cover all characters needed for English. The 8th bit was reserved for parity checking (error detection in data transmission) and was later repurposed by various extended encodings.
Q5: What is the “printable” range of ASCII values?
Characters from decimal 32 to 126 are printable, including the space (32) and tilde ~ (126).
9. Conclusion
Despite having only 128 characters, ASCII is the cornerstone of the entire digital world. Understanding ASCII encoding helps you work more effectively with string processing, network protocols, and file encodings — and makes debugging character encoding issues far less painful.
Want to convert ASCII codes quickly? Try our Online ASCII Converter for bidirectional conversion between text and ASCII codes, with support for decimal, binary, octal, and hexadecimal formats.