The ASCII Table Explained: Code Points 0–127, Bases, and Why 'A' Is 65
How the ASCII table maps 128 code points to characters, why 'A' is 65 and 'a' is 97, how to read decimal/hex/binary columns, and ASCII's role under UTF-8.
The ASCII Table Explained: Code Points 0–127, Bases, and Why 'A' Is 65
Every character your computer handles started life as a number. The ASCII table is the oldest, simplest version of that mapping still in daily use, and once you can read it, a surprising number of "weird text" problems stop being mysterious. ASCII defines exactly 128 code points, numbered 0 through 127, and that small range covers the entire English-language keyboard plus a set of control codes that predate the keyboard you're typing on.
This post walks through what those 128 numbers mean, why the table is laid out the way it is, how the decimal/hex/binary columns relate, and why ASCII still matters in a UTF-8 world.
128 Code Points, Three Groups
ASCII fits in 7 bits. Seven bits can represent 2⁷ = 128 distinct values, which is where the 0–127 range comes from. The table splits cleanly into three groups:
- Control characters (0–31): 32 non-printing codes that originally drove teletypes, terminals, and serial links. NUL (0) terminates C strings, TAB (9) indents, LF (10) and CR (13) handle line endings, ESC (27) opens every terminal color and cursor sequence.
- Printable characters (32–126): the space at 32, then punctuation, digits, uppercase letters, lowercase letters, and a handful of symbols. This is everything you can actually see.
- DEL (127): a lone leftover from paper tape, where "delete" meant punching out every hole in a column.
A few exact landmarks are worth memorizing because they show up constantly: 32 is the space, 48–57 are the digits 0–9, 65–90 are the uppercase letters A–Z, and 97–122 are the lowercase letters a–z. Notice that the digit 0 is not code point 0 — it's 48. That single fact trips up more beginners than any other part of the table.
A Worked Example: Four Characters in Decimal and Hex
Let's pin down four of the most common characters so the columns feel concrete. Here is each one in decimal and two-digit hexadecimal:
| Character | Decimal | Hex | |-----------|---------|-----| | A | 65 | 0x41 | | a | 97 | 0x61 | | 0 | 48 | 0x30 | | space | 32 | 0x20 |
Read that table sideways and the structure clicks. The space is 0x20, which is exactly 32 — and 32 is the boundary where printable characters begin. The digit 0 is 0x30; every other digit follows, so 7 is 0x37. Uppercase A is 0x41 and lowercase a is 0x61, and the hex makes the relationship obvious: the only difference is the 4 versus the 6 in the high nibble.
Why 'A' Is 65 and 'a' Is 97 (the 32 Gap)
The gap between A (65) and a (97) is exactly 32. That is not a coincidence, and it is the single most useful pattern in the whole table.
The designers of ASCII placed uppercase and lowercase letters so that the only difference between a capital and its lowercase form is one bit: the bit worth 32 (the sixth bit, value 2⁵). Look at it in binary and it's unmistakable:
A= 65 =1000001a= 97 =1100001
Every other bit is identical. Flip that one bit and A becomes a; flip it back and a becomes A. That is why old C code can change case with a single XOR or addition — c ^ 0x20 toggles the case of any ASCII letter, and c | 0x20 forces lowercase. The 32 gap turned case conversion into bit arithmetic, which on 1960s hardware mattered a great deal.
The digits got the same care: 0 through 9 sit at 48–57, so the numeric value of a digit character is simply code − 48. Parsing "7" into the number 7 is just '7' - '0', a trick that survives in nearly every language today.
Reading the Bases: Decimal, Hex, Binary
The same code point shows up in three bases, and each is useful in a different context.
- Decimal is what you say out loud and what
charCodeAt/ord()return. - Hexadecimal is what you see in a hex dump (
xxd), a\xNNescape, or a Unicode code point likeU+0041. Two hex digits cover the whole printable range neatly. - Binary is where bit patterns like the case-flip bit become visible.
Converting between them is mechanical: A is decimal 65, which is 0x41, which is 0100 0001 in eight bits (ASCII uses 7 bits but bytes are 8, so the top bit is 0). If you want to watch a whole string turn into its bit pattern, our text to binary converter does it character by character, and it's a fast way to see the 32 gap flip as you type uppercase versus lowercase.
I keep the ASCII table reference open in a pinned tab whenever I'm reading serial logs. The last time a device kept "eating" my commands, I dumped the raw bytes and found 0x0D 0x0A at the end of each line — CR followed by LF. The firmware expected bare LF. Five seconds with the table told me the line ending was the bug, not my protocol, and I'd have wasted an hour guessing without it.
ASCII Under UTF-8: Still the Foundation
You might assume ASCII is a museum piece now that everything is Unicode. The opposite is true: UTF-8, the dominant text encoding on the web, was deliberately designed to be backward compatible with ASCII.
In UTF-8, any code point from 0 to 127 is encoded as a single byte whose value is identical to its ASCII code. The letter A is the byte 0x41 in ASCII, and it's the byte 0x41 in UTF-8 too. That means every plain ASCII file is already a valid UTF-8 file, with no conversion needed. Only when a character needs a code point above 127 does UTF-8 switch to multi-byte sequences, and it flags those by setting the high bit (the byte is ≥ 128). So a byte under 128 is always a standalone ASCII character; a byte of 128 or more is part of a longer sequence.
This is also why "extended ASCII" (128–255) is a trap. ASCII proper stops at 127. The bytes from 128 to 255 mean different things under Latin-1, Windows-1252, code page 437, and a dozen other legacy encodings — and under UTF-8 they aren't standalone characters at all. The byte 0xE9 might be é in Latin-1, a smart quote in Windows-1252, or one third of an emoji in UTF-8. Knowing the encoding before you interpret those bytes is the whole game.
Takeaways
The ASCII table is small enough to internalize and structured enough to reward the effort. Remember the landmarks — space at 32, digits at 48, uppercase at 65, lowercase at 97 — and the 32 gap that links each letter to its other case. Read the columns as three views of one number, and remember that UTF-8 keeps every one of those 128 code points exactly where ASCII put them. Once that picture is in your head, hex dumps, line-ending bugs, and case-conversion tricks all become readable instead of cryptic.
Made by Toolora · Updated 2026-06-13