ASCII 0–31 · 127 · THE CONTROL CHARACTERS

The 33 Invisible Characters

ASCII has 128 codes, and 33 of them print nothing. They were made to run teleprinters: ring a bell, return the carriage, switch on a tape punch, end a transmission. This page tells where each one came from, whether anything still uses it, and lets you try every one of them.

Are they still used?

every day: you send or receive it daily, often without knowing niche: alive in particular protocols, devices or industries retired: the original job is gone; at most the Ctrl key lives on

The story

Before screens, a computer terminal was a typewriter wired to a line: a teleprinter. Letters arrived as codes and were printed. Everything else the machine could do (go back to the margin, roll the paper, ring for the operator, start the tape reader) also had to arrive as a code, because the wire was the only way in. Those codes are the control characters, and their names still describe the machinery.

  1. 1870sBaudot's five-unit code. Émile Baudot's printing telegraph sent each character as five on/off units, 32 combinations, with a letters/figures shift to fit more. Shifting is the first "control" idea: a code that changes what the next codes mean.
  2. 1901Murray's tape code. Donald Murray rearranged the code for a typewriter-style keyboard that punched paper tape, and added codes that print nothing: carriage return and line feed. The format effectors were born.
  3. 1920s–30sITA2, the telex alphabet. The international standard had a blank (null) code, CR, LF, a bell, and WRU, "who are you?", which made the distant machine send back its identity from an answer-back drum. The all-holes code (letters shift) was harmless, so operators erased mistakes on tape by overpunching them with it.
  4. 1963ASCII. The American Standards Association published a 7-bit code, X3.4-1963. The committee, with people from telegraphy, computing and business machines, gave the first 32 codes to control functions and put DEL, all seven bits set, at 127. The Teletype Model 33, launched the same year and cheap, made ASCII the language of minicomputers and later of Unix.
  5. 1967The names we use. The revision added lower case and settled the control names (WRU became ENQ). ECMA-6 and ISO 646 made the same 33 international.
  6. 1976–78Escape sequences. Instead of spending more codes, a terminal could take ESC followed by ordinary characters. ECMA-48 (1976) and ANSI X3.64 standardised them; the DEC VT100 (1978) made them universal, and every terminal emulator still speaks that dialect.
  7. 1991Unicode. The 33 keep their numbers as U+0000–U+001F and U+007F, 32 more (the C1 controls) sit at U+0080–U+009F, and the Control Pictures block gives each a visible stand-in: ␀ ␁ ␂ … ␟ ␡. This page uses them.

Most of the 33 were designed for a world of leased lines and mechanical printers that is gone. What survived falls into three kinds: the ones every text still needs (tab, newline, the bell, escape), ones that became something else because they sit under a Ctrl key, and ones that found a niche as delimiters that no text can contain.

Where they sit in the table

ASCII is drawn as 8 columns of 16. The column is the top three bits, the row the bottom four. Columns 0 and 1, where the top two bits are 00, hold all 32 controls, so a machine could tell "act" from "print" by looking at two bits. Space opens column 2, upper case lives in column 4–5 and lower case in 6–7, 32 apart, so changing case is flipping one bit.

DEL is the exception, alone at 127 because on paper tape it had to be all holes. A hole can't be filled back in, so any character can be turned into DEL by punching the rest of its holes, and every reader was built to skip it. NUL, no holes at all, is blank tape.

The Ctrl key on the Model 33 cleared the bit worth 64 of whatever key you held, so Ctrl+G sent 0000111 instead of 1000111: BEL. Keyboards still work that way, and it gives caret notation, the way terminals print controls: ^G for BEL, ^[ for ESC, ^@ for NUL, and ^? for DEL (0x3F with the 64 bit set is 0x7F). Click any cell to see its partner.

The 33, one by one

Each card says what the character was for, what uses it today, and shows an example. The ▶ buttons load the example into one of the labs further down.

Labs

Lab 1 · A teleprinter with a tape punch and reader

A Model 33-style ASR set (“automatic send-receive”): printer, paper-tape punch and tape reader in one machine. Whatever you type is printed at 10 characters a second and, while the punch is on, punched into tape. The printer only has upper case, can't erase, and piles characters up in the last of its 72 columns if nobody sends CR. Hold Ctrl in the typing field to send controls the way an operator did (Ctrl+G rings the bell).

Print:

Tape

Tape demos:

Tape tracks from the top: 8 (parity, punched when the other seven have an odd number of holes), 7–4, the small sprocket hole, 3–1. NUL is blank tape; DEL is every hole, so a rubbed-out frame looks the same whatever was under it. Blue print came from the answer-back drum, not the keyboard.

Lab 2 · A terminal: ESC, SO/SI, CAN, BEL, CR

A small VT100/xterm-style emulator. Screens replaced paper, but the bytes stayed: CR, LF, BS and HT still move the cursor, BEL still rings, and ESC starts the sequences that set colours, move the cursor and set the window title. Pick an example or write your own bytes.

●●●terminal
The bytes you send appear here.
Replies from the terminal (to ENQ and status requests) appear here.

Lab 3 · Your keyboard still sends them

Every Ctrl+letter is one of the 33. In a Unix terminal the bytes first reach the terminal driver (the tty “line discipline”), which acts on several of them before any program sees a thing. Here cat is running in the normal “cooked” mode with Linux defaults, so lines are edited by the driver and only handed over on Enter. Click the screen and type, or use the buttons; the browser keeps Ctrl+W, Ctrl+T and Ctrl+N for itself, so those are buttons only.

●●●tty
Bytes the driver received:

From stty -a. ^H is not on the list on Linux, so it is just a character: it gets echoed as ^H and ends up in the line. That is where the famous ^H^H^H comes from.

Lab 4 · XON and XOFF

A computer sends at 120 characters a second to a printing terminal that manages 30 and has a 32-character buffer. With flow control the printer sends XOFF (DC3) when its buffer is three-quarters full and XON (DC1) when it has room again. The computer takes a few characters to react, which is why XOFF goes out before the buffer is full. Without flow control, whatever doesn't fit is lost.

Printer buffer: XOFF at 24 (red), XON at 8 (green)

Computer sends

Printer prints

XON/XOFF events appear here.

Lab 5 · XMODEM: SOH, ACK, NAK, EOT, CAN and SUB

Ward Christensen's 1977 file transfer protocol, written for CP/M machines talking through modems, has a vocabulary of almost nothing but control characters. The receiver asks with NAK, each 128-byte block starts with SOH and ends with a one-byte checksum, ACK means “good, next”, NAK means “again”, EOT ends the file and CAN CAN gives up. The last block is padded with SUB, the CP/M end-of-file mark. Add noise to see blocks resent.

The received file appears here.

Lab 6 · Framing a serial line: STX, ETX, ETB, ENQ, DLE, SYN

Blood analysers in hospital labs send results to the lab computer with a protocol from 1991 (ASTM E1381, now CLSI LIS01-A2) that is all transmission controls. The instrument asks for the line with ENQ, sends each record in frames STX frame-number text ETB or ETX, two hex checksum digits, CR LF, waits for ACK after each frame, and ends with EOT. Records longer than a frame continue in the next one: those frames end in ETB. Edit the records:

Lab 7 · Separators in real data: SOH, GS, RS, US

FIX, the Financial Information eXchange protocol (1992), is how brokers, banks and exchanges send orders to each other. A message is tag=value pairs, each ended by SOH. BodyLength (9) counts the bytes after it up to the checksum, and CheckSum (10) is the sum of every byte before it, modulo 256. Logs usually print SOH as |.

Lab 8 · Inspector: what software does with them today

Control characters can't be typed into most text boxes, but they can be pasted. Insert some, or paste text from anywhere, and see what JSON, URLs, the XML parser and the HTML parser of this browser make of it. The JSON, URL, XML and HTML rows are run live. A text box quietly turns CR LF into LF, so CR is shown in it as ␍.

Sources and notes

What is simplified: the teleprinter is a model, not a mechanism (tab stops every 8 columns, vertical tab stops every 4 lines, 12-line pages so form feed shows). The terminal implements a subset of VT100 and xterm. Lab 3 models the Linux terminal driver in cooked mode with a toy shell in place of bash and readline. The formats in Labs 5 to 7 are built and checked the way the standards describe, with made-up data.