Skip to the workspace
Pebellslearn by building
Character Encodings  ›  Lesson

ASCII — 128 Characters, 7 Bits

ASCII 12 minASCII assigns the numbers 0 to 127 to English letters, digits, punctuation and control characters, so each fits in 7 bits.

computer science / ASCII — 128 Characters, 7 Bits

Explore each scene at your own pace.

01 · The rule

The rule

ASCII — 128 Characters, 7 Bits

When you press the key A, the computer does not store a picture of the letter. It stores a number, and every program on the machine agrees which number means A. The first widely adopted agreement, from the 1960s, is ASCII, and it still sits underneath almost all text today.

The rule

ASCII gives 128 characters the numbers 0 to 127: seven bits each.

ASCII (American Standard Code for Information Interchange) covers:

  • 0–31 and 127: invisible control characters, such as newline (10), carriage return (13) and tab (9).
  • 32: the space.
  • 48–57: the digits 0–9.
  • 65–90: capitals A–Z.
  • 97–122: lowercase a–z.
  • The gaps hold punctuation and symbols, like ! (33) and @ (64).

Since 127 is the biggest code, 7 bits are enough; in practice each character is stored in a full byte with the top bit 0.

Notice the character '7' is not the number 7. It is code 55. Text that looks like a number must be converted before you can do arithmetic with it.

ASCII has no é, no ñ, no ₹ and nothing from Hindi, Chinese or Arabic. That limit is why Unicode exists, which is the next lesson.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.