← All posts

Reading character tables like a pro: a practical ASCII reference guide

Reading character tables like a pro: a practical ASCII reference guide

Here is a question that sounds like it has an easy answer and absolutely does not: what is the difference between | and │? Both are a vertical line. Only one of them lines up with the other thing you just drew. Why?

Wait. Let me show you something. Every character you have ever typed has a number attached to it, and that number has an address in a table. There are 128 of them in the ASCII table, laid out in sixteen rows, and once you can read that table the way you read a street map, a whole invisible layer of the internet becomes readable. This is my ascii reference guide — the one I taped above my desk in 1986 and never took down. If you have ever wanted a character table tutorial that teaches you to use the table instead of just look at it, this is it.

The table is not a table, it is an address book

Here is where people go wrong. They look at an ASCII chart the way they would look at a periodic table of elements, expecting rows of stuff with labels. But the useful way to read it is as an address book. Every glyph lives at a street address. A is 65 decimal, 0x41 hex. Space is 32, 0x20. The tilde at the far corner is 126, 0x7E.

This is the character table tutorial part that matters most, and almost nobody teaches it this way. When you stop asking "what is character 73" and start asking "what neighborhood does character 73 live in", the table turns from a wall into a map. Every character table tutorial I have ever seen taught you the addresses and left out the neighborhoods.

Think of hex as a compact locker-number system. Floor 4, locker 1 — that is 0x41. You do not need to memorize a single address. You need to know the pattern of the neighborhood, because the pattern is what lets you guess.

So here is the neighborhood map, the part I actually taped up:

0x20 ␠!"#$%&'()*+,-./
0x30  0123456789:;<=>?
0x40  @ABCDEFGHIJKLMNO
0x50  PQRSTUVWXYZ[\]^_
0x60  `abcdefghijklmno
0x70  pqrstuvwxyz{|}~

Sixteen characters per row, with the high nibble in the label on the left. The ␠ is a visible stand-in for the space character, because otherwise row 0x20 would start with a hole. That is the entire skeleton. Once you can see that shape, the table stops being a wall of symbols and becomes a machine with parts you can predict.

The digit gift: 0x30 and the ascii reference guide on a napkin

Look at the row labeled 0x30. The digits start there and run for ten slots. That is not a coincidence, and it is one of the most elegant decisions in the whole history of computing.

Here is the problem 1963 was solving: the machines that made these tables were adding machines, and they added decimal. If the character for 5 is 0x35, then that character is the number 5 plus 48. Take the number, add 48, and you have the character. A machine that could add could print.

So here is the practical version of this, the one that saves me from looking things up constantly: if a number is on screen, its code is that number plus 48. The character 7 is 55. The character 9 is 57. That is the single most useful arithmetic fact in the ascii reference guide, and it works because the designers were thinking about decimal machines, not about elegance.

The shift bit: why uppercase and lowercase are one bit apart

Now look at the rows labeled 0x40 and 0x60. The uppercase letters run 0x41 through 0x5A. The lowercase run 0x61 through 0x7A. The gap between 0x5A (Z) and 0x61 (a) is 0x07 — six digits and one bit of structure between them.

But the real trick is one bit. Take the low five bits of any uppercase letter, add 0x20, and you have the lowercase letter. A is 65. a is 97. The difference is 32. One bit. Toggle that bit and the letter changes case.

Why did they build it that way? Because a teletype had a single Shift key, and the machine's mechanical logic had to be simple. If uppercase and lowercase differed by one lever in one place, the shift mechanism was trivially cheap. The hardware dictated the table, and the table is still in your keyboard layout right now.

This is the moment the whole thing stops being memorization and starts being reading. Ask a question and the table answers it: A is 65. I want to XOR it with 0x20. 65 is 0100 0001. Toggle bit 5 — 0x20 — and you get 0110 0001, which is 97, which is a. You did not look it up. You computed it.

And this bit math matters more for art than you would expect. In DOS text mode on a monochrome monitor, code page 437 rendered the whole upper range, 128 through 255, in dim gray while the low range stayed bright. One extra bit, and you got a second tone for free — which is why so much of the good ANSI art of the eighties has a dark gray you cannot reproduce on a modern terminal.

The two halves: printable, and the thirty-three ghosts

Now the structure of the whole table. The first 32 slots, 0x00 through 0x1F, are control characters, and DEL at 0x7F way out at the far right is the 33rd. That leaves 95 printable ones, running from 0x21 ! to 0x7E ~. Two neighborhoods, one shared fence.

The control characters are the ghosts I love. They have no glyph. When you look at a chart, 0x07 BEL looks empty and 0x1B ESC looks empty, and you might think the table is padded with blanks. It is not. Each of those slots is a command, an action the terminal performs rather than a picture it draws. ESC is the escape character: the byte that says "the next bytes are a command sequence, not text." BEL rings the bell. Backspace moves the cursor. These are the invisible hand of the machine reaching into the visible page.

Here is where it gets weird. The control characters live in the low end of the range because they predate ASCII — they came from teletypes and telegraph codes where physical keys literally did things to the paper. The printable half was added later, in 1963, when the committee decided text should have a full alphabet. So the ASCII table is not one invention. It is two welded together: machine actions from the typewriter era, symbols from the printing-press era. That seam is still visible if you know where to look.

Why your box corners do not line up

Back to the vertical line question, because now we can answer it properly.

Pure ASCII has exactly one vertical stroke character: |, at 0x7C. Exactly one horizontal: -, at 0x2D. And when I was learning this, my first attempt at a box was this:

+-----+
|     |      ┌─────────────┐
|     |      │  pure ASCII │
|     |      └─────────────┘
+-----+

The left frame is the honest one — every character in it is plain ASCII, and it will render identically on every terminal on Earth. The right one is what you actually want, and it is not ASCII at all. Those strokes are box drawing characters from Unicode, U+2500 and neighbors, and they look a fraction better because they are designed to sit in the middle of the cell.

Why did we all end up outside the table? Because the table's one vertical stroke, | at 0x7C, has to live in a cell that is also home to letters, and the font has to decide how wide a bar is. Most fonts draw | slightly narrow, so it never quite meets the - above it. IBM's PC codepage 437 solved this by adding single-line and double-line box drawing characters in the 128–255 range, aligned to the grid. │ is not ASCII. It is an extended character from an OEM code page, and then, later, a Unicode block that inherited the shape.

The moment you draw that frame with | instead of a box drawing stroke, you have left the ASCII table and entered the territory of extended code pages, and the moment you paste that art into a program or a chat client that does not happen to be running CP437, the corners dissolve into garbage characters. I have lost whole posts to that. The characters are not wrong. The agreement about what they mean is missing.

This is the part of the character table tutorial nobody tells you: the table is not just a lookup, it is a contract. The number is stable. The glyph is a promise made by whatever font and code page is running.

Unicode, or how the table became a neighborhood

Unicode, first published in 1991, made the contract explicit and much bigger. It gave every character a fixed address — but the address is no longer a single byte. It is a code point, usually 16 bits, sometimes 32, and the bytes on the wire are a separate question entirely, which is why UTF-8 exists and why encoding bugs still ruin people's evenings.

But the important part for us is what happened to the idea of the table. It became a set of tables. Box drawing elements. Block elements. Braille patterns. Mathematical operators. Each block has its own neighborhood of addresses, and once you know that blocks like U+2500–U+257F are box drawing, you can find the character you need by category instead of by scrolling a spreadsheet of ten thousand rows.

Braille is my favorite corner. One braille character is a 2-by-4 dot grid, so 40 columns of braille is 80 dots wide and 160 tall in pixel terms. That is a real image, encoded as text, small enough to paste into a forum post. The text pixel art guide goes deeper, but the headline is: the grid never went away, the cell just got more addressable.

Actually practicing: build your own tiny reference

Here is the part that turns reading into knowing. It takes ten minutes and no software beyond a text editor.

Type this: for i in range(32, 127): print(f"{i:3d} 0x{i:02X} {chr(i)}") — one line, and it prints the printable range with its decimal and hex addresses. Change the range to 0 through 31 and you have met the ghosts. Change it to 128 and you can watch what a modern terminal does with the extended range.

Then the good exercise. Write a tiny program that prints a box using only characters between 0x21 and 0x7E — pure ASCII, no exceptions — and measure how it looks. Then rewrite it with box drawing characters and measure again. One of them is a typewriter drawing; the other is a computer drawing that happens to be made of text.

When you want to see what a given character actually is on your screen, ord() in Python gives the number, and chr() gives you the character back. Those two functions are the whole table, compressed into a pair of keystrokes.

If you want the ascii table explained as one picture instead of nine paragraphs, it is this: a number on the left, a glyph on the right, and a rule that says which glyph belongs to which number. Everything else — hex columns, the shift bit, the ghosts — is a consequence of that arrangement.

That is the whole of a practical ascii guide, honestly. Ten minutes, one terminal, one piece of paper with the neighborhood map on it.

Where to go from here

If you want a place to test what you have learned — to try a font, to see whether a glyph set covers the characters you need, to watch an image turn into a grid of cells — the ascii.im studio does that in seconds. If you want to know how the grid shapes what is drawable in the first place, the text pixel art guide is the deeper cut. And the pricing page lists the export options.

Now the callback, because you know I like these.

Every curve on your screen that people call an "emoticon" is a two-or-three-character negotiation with a table that was settled in 1963, written by committee, refined by teletype mechanics, and stretched by a font designer who never met you. That is what an ascii reference guide actually is: not a list of symbols, but a map of agreements. The number says what it is. The glyph says what it looks like here. And when those two disagree, the art breaks in ways that look like your fault and are not.

So here is the question I would leave on the channel tonight. If every artist is really negotiating with a table of addresses — if the drawing you made is only ever a set of numbers waiting for someone else's font to give them a body — how much of the art is yours, and how much is the table's? I have a position on this, and I suspect most of you do too.

Reading character tables like a pro: a practical ASCII reference guide — ascii.im Blog