The ASCII table is the Rosetta Stone of computing – it maps every character you can type to a number, and that number to binary and hex. Understanding it unlocks how text actually works inside a computer.
What Is ASCII?
ASCII (American Standard Code for Information Interchange) assigns a number from 0 to 127 to 128 characters: uppercase and lowercase letters, digits, punctuation, and control characters (like newline and tab).
Each ASCII code is stored as one byte. For example:
- `A` = 65 = `01000001` binary = `0x41` hex
- `a` = 97 = `01100001` binary = `0x61` hex
- `0` = 48 = `00110000` binary = `0x30` hex
The Table Structure
ASCII is organized in a deliberate pattern:
| Range (decimal) | Characters | Example |
|---|---|---|
| 0-31 | Control characters | 10 = newline, 9 = tab |
| 32-47 | Space & punctuation | 32 = space, 46 = `.` |
| 48-57 | Digits 0-9 | 48 = `0`, 57 = `9` |
| 58-64 | More punctuation | 64 = `@` |
| 65-90 | Uppercase A-Z | 65 = `A`, 90 = `Z` |
| 91-96 | Punctuation | 95 = `_` |
| 97-122 | Lowercase a-z | 97 = `a`, 122 = `z` |
| 123-127 | Punctuation | 126 = `~`, 127 = delete |
Notice the elegant pattern: lowercase letters are exactly 32 more than their uppercase versions (A=65, a=97). In binary, that difference is a single bit – the 6th bit. Flipping one bit toggles case, which is why case conversion is so cheap for computers.
Key Characters Reference
Digits
| Char | Dec | Hex | Binary |
|---|---|---|---|
| 0 | 48 | 30 | 00110000 |
| 1 | 49 | 31 | 00110001 |
| 9 | 57 | 39 | 00111001 |
Uppercase letters
| Char | Dec | Hex | Binary |
|---|---|---|---|
| A | 65 | 41 | 01000001 |
| M | 77 | 4D | 01001101 |
| Z | 90 | 5A | 01011010 |
Lowercase letters
| Char | Dec | Hex | Binary |
|---|---|---|---|
| a | 97 | 61 | 01100001 |
| m | 109 | 6D | 01101101 |
| z | 122 | 7A | 01111010 |
Common punctuation and whitespace
| Char | Dec | Hex | Binary |
|---|---|---|---|
| (space) | 32 | 20 | 00100000 |
| ! | 33 | 21 | 00100001 |
| . | 46 | 2E | 00101110 |
| @ | 64 | 40 | 01000000 |
Control Characters (0-31)
The first 32 codes aren’t printable characters – they’re instructions:
- 0 (NUL): Null terminator – marks the end of a string in C
- 9 (TAB): Horizontal tab
- 10 (LF): Line feed – the `n` newline on Unix/Linux/macOS
- 13 (CR): Carriage return – the `r` in Windows’ `rn` line endings
- 27 (ESC): Escape – starts terminal control sequences
- 127 (DEL): Delete
This is why Windows and Unix text files have historically been incompatible at the byte level: Windows ends lines with bytes 13+10 (`rn`), Unix with just byte 10 (`n`).
How Text Becomes Binary: A Full Example
Let’s encode “Hi!” step by step:
“`
H → 72 → 01001000
i → 105 → 01101001
! → 33 → 00100001
“`
The full binary: `01001000 01101001 00100001`
In hex: `48 69 21`
Paste “Hi!” into our binary converter to see this encoding happen live, with the ASCII table as reference.
ASCII vs Unicode
ASCII covers only 128 characters – no accented letters, no Chinese, no emoji. Unicode extends the same idea to over 149,000 characters, and UTF-8 is the encoding that stores them.
The clever part: UTF-8 is backward compatible with ASCII. The first 128 Unicode code points are identical to ASCII, so plain English text is byte-for-byte identical in ASCII and UTF-8. That’s why ASCII knowledge still applies everywhere.
Practical Uses of the ASCII Table
- Debugging: Reading raw bytes in a hex editor? The ASCII column tells you if you’re looking at text.
- Programming: `’A’ + 32 = ‘a’` works in C because of the 32-offset pattern.
- Web: URL encoding uses ASCII hex – a space becomes `%20` (hex 20 = decimal 32).
- Networking: Protocols like HTTP are ASCII-based; headers are human-readable bytes.
Frequently Asked Questions
What is the ASCII code for A?
65 in decimal, 0x41 in hex, 01000001 in binary. Lowercase a is 97 (0x61).
How do I convert hex to ASCII?
Split the hex into byte pairs, convert each pair to decimal, then look up the character. For example, `48 65 6C 6C 6F` → 72, 101, 108, 108, 111 → “Hello”. Our binary converter does hex-to-text conversion automatically.
Why is a space ASCII 32?
The first 32 codes (0-31) were reserved for control characters, so printable characters start at 32. Space got the first printable slot.
What's the difference between ASCII and UTF-8?
ASCII is a 128-character set; UTF-8 is an encoding for Unicode’s 149,000+ characters. UTF-8’s first 128 byte values are identical to ASCII, so English text is the same in both.
How many bits is an ASCII character?
Standard ASCII uses 7 bits (values 0-127), but it’s almost always stored in an 8-bit byte with the top bit set to 0.