Home·ASCII

The 128 ASCII codes

Decimal, hex and binary through to HTML entities and Ctrl keys — all worked out from the code. The table also shows why upper and lower case sit exactly 32 apart.

The chart

Eight columns for the top three bits, sixteen rows for the bottom four. The capitals column sits right beside the lowercase one — that is the shape of the table.

Control33

Characters that draw nothing and instead tell the device to do something.

Space1

It draws nothing, yet it takes up a column.

Digits10

Zero sits at 48, so the bottom four bits are the digit itself.

Uppercase26

A starts at 65 and twenty-six letters follow.

Lowercase26

a starts at 97 — the capital plus 32.

Punctuation32

The marks scattered between the digits and the letters.

The 33 control codes33

Formatting

Line breaks, tabs and page feeds — the ones still in daily use.

Separators

Four nested separators: file, group, record, unit.

Others

Deleting, cancelling, and ESC — the key that opens a second meaning.

How to read this

  • Add 32 to a capital and you get the lowercase letter — one bit flips.
  • Digits start at 48, so subtracting 48 from the code gives the number.
  • Holding Ctrl clears the top three bits — that is why Ctrl+I is a tab.
  • Everything under 32, plus 127, draws nothing. Those show their abbreviation instead.

Frequently asked questions

Q. Why are there only 128 ASCII codes?

Because the code is seven bits wide, and two to the seventh is 128.

Q. Why do upper and lower case differ by 32?

The table was laid out so a single bit — the sixth — separates them. Flip it and the case changes.

Q. Why does Ctrl+I give a tab?

Ctrl clears the top three bits. I is 73; keep the bottom five and you get 9, which is tab.

Q. Are control codes still used?

Line feed (10), carriage return (13), tab (9) and ESC (27) are used daily. Most of the rest belong to the teleprinter era.

Q. What about characters above 128?

They are not ASCII. Unicode covers them, and UTF-8 keeps ASCII unchanged in its first 128 slots.