Home·ASCII
Ad

Claim your crypto exchange bonus

Bonuses you get just for signing up. Terms are copied straight from each exchange.

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.

0NUL1SOH2STX3ETX4EOT5ENQ6ACK7BEL8BS9HT10LF11VT12FF13CR14SO15SI16DLE17DC118DC219DC320DC421NAK22SYN23ETB24CAN25EM26SUB27ESC28FS29GS30RS31US32SP33!34"35#36$37%38&39'40(41)42*43+44,45-46.47/48049150251352453554655756857958:59;60<61=62>63?64@65A66B67C68D69E70F71G72H73I74J75K76L77M78N79O80P81Q82R83S84T85U86V87W88X89Y90Z91[92\93]94^95_96`97a98b99c100d101e102f103g104h105i106j107k108l109m110n111o112p113q114r115s116t117u118v119w120x121y122z123{124|125}126~127DEL

Control33

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

0 NUL1 SOH2 STX3 ETX4 EOT5 ENQ6 ACK7 BEL8 BS9 HT10 LF11 VT12 FF13 CR14 SO15 SI16 DLE17 DC118 DC219 DC320 DC421 NAK22 SYN23 ETB24 CAN25 EM26 SUB27 ESC28 FS29 GS30 RS31 US127 DEL

Space1

It draws nothing, yet it takes up a column.

32 SP

Digits10

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

48 049 150 251 352 453 554 655 756 857 9

Uppercase26

A starts at 65 and twenty-six letters follow.

65 A66 B67 C68 D69 E70 F71 G72 H73 I74 J75 K76 L77 M78 N79 O80 P81 Q82 R83 S84 T85 U86 V87 W88 X89 Y90 Z

Lowercase26

a starts at 97 — the capital plus 32.

97 a98 b99 c100 d101 e102 f103 g104 h105 i106 j107 k108 l109 m110 n111 o112 p113 q114 r115 s116 t117 u118 v119 w120 x121 y122 z

Punctuation32

The marks scattered between the digits and the letters.

33 !34 "35 #36 $37 %38 &39 '40 (41 )42 *43 +44 ,45 -46 .47 /58 :59 ;60 <61 =62 >63 ?64 @91 [92 \93 ]94 ^95 _96 `123 {124 |125 }126 ~

The 33 control codes33

Formatting

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

8BSBackspace^H9HTHorizontal tab^I10LFLine feed^J11VTVertical tab^K12FFForm feed^L13CRCarriage return^M

Transmission

Codes that marked where a message began and ended, and whether it arrived.

1SOHStart of heading^A2STXStart of text^B3ETXEnd of text^C4EOTEnd of transmission^D5ENQEnquiry^E6ACKAcknowledge^F16DLEData link escape^P21NAKNegative acknowledge^U22SYNSynchronous idle^V23ETBEnd of transmission block^W

Device

Codes that rang a bell or switched the character set on a device.

7BELBell^G14SOShift out^N15SIShift in^O17DC1Device control 1^Q18DC2Device control 2^R19DC3Device control 3^S20DC4Device control 4^T

Separators

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

28FSFile separator^\29GSGroup separator^]30RSRecord separator^^31USUnit separator^_

Others

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

0NULNull^@24CANCancel^X25EMEnd of medium^Y26SUBSubstitute^Z27ESCEscape^[127DELDelete^?

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

QWhy are there only 128 ASCII codes?

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

QWhy 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.

QWhy 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.

QAre 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.

QWhat about characters above 128?

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