81. ASCII

Read the ASCII table and understand why 7-bit ASCII is the foundation of digital text.

By Jacques Botte, founder of Toptronic®. Last updated 12 September 2026.

The lesson

ASCII (American Standard Code for Information Interchange) is a character-encoding standard that assigns a number from 0 to 127 to every character in its set. It is called a 7-bit encoding because 7 bits can represent exactly 128 values. Almost every text file, source file, and protocol header you have ever used relies on ASCII for its base layer.

The ASCII table is split into three main regions. Codes 0 to 31 are non-printing control characters such as NUL (0), TAB (9), line feed LF (10), and carriage return CR (13). Code 32 is the space character, which is the first printable character. Codes 33 to 126 are the printable characters: punctuation, the digits, the uppercase letters, and the lowercase letters. Code 127 is DEL.

The printable ranges are easy to memorise. The digits '0' to '9' occupy codes 48 to 57. The uppercase letters 'A' to 'Z' occupy codes 65 to 90. The lowercase letters 'a' to 'z' occupy codes 97 to 122. So '0' is 48, 'A' is 65, and 'a' is 97. This consistent ordering is why text can be sorted and compared so easily by a computer.

Common printable reference values: space 32, '!' 33, '0' 48, '9' 57, 'A' 65, 'M' 77, 'Z' 90, 'a' 97, 'm' 109, 'z' 122. Lowercase letters are always exactly 32 more than their uppercase equivalents, which is why toggling case in many languages simply adds or subtracts 32.

ASCII only covers the English alphabet, digits, basic punctuation, and control codes. It cannot represent accented characters (é, ñ), Cyrillic, Greek, Arabic, Hebrew, CJK (Chinese, Japanese, Korean), emoji, or most of the world's scripts. That limitation is exactly why Unicode and UTF-8 were created, which is covered in the next lesson (82).

Why this matters for TPEE: when you export a prompt, view a character count, or save a JSON file, the underlying bytes may be UTF-8, but every ASCII character is still encoded in exactly one byte. Understanding the table helps you reason about text size, encodings, and why some files are larger than others.

In practice, you rarely type ASCII codes by hand, but you will see them in documentation, debuggers, network protocols, and low-level tools. Recognising that 65 = 'A' and 97 = 'a' makes reading hex dumps and byte-oriented error messages much easier.

Check yourself

Question 1: How many distinct characters can the 7-bit ASCII encoding represent?
  1. 64
  2. 128 — correct
  3. 256
  4. 1,024

Answer: 128

ASCII uses 7 bits, which encode exactly 128 values (0 to 127). This covers control characters, the space, punctuation, digits, and both upper and lower case English letters.

Question 2: In the ASCII table, which numeric range holds the digits '0' to '9'?
  1. 33 to 47
  2. 48 to 57 — correct
  3. 65 to 90
  4. 97 to 122

Answer: 48 to 57

The digits occupy codes 48 to 57 ('0' = 48, '9' = 57). Uppercase 'A' to 'Z' is 65 to 90 and lowercase 'a' to 'z' is 97 to 122.

Question 3: Which of these is a non-printing ASCII control character?
  1. Space (code 32)
  2. Line feed / LF (code 10) — correct
  3. Lowercase 'a' (code 97)
  4. Digit '1' (code 49)

Answer: Line feed / LF (code 10)

Codes 0 to 31 are non-printing control characters. Line feed (LF, code 10) and carriage return (CR, code 13) are common control characters; the space (32) is the first printable character.

← Previous lesson · All 83 lessons · Next lesson →

The full course — 83 lessons and 249 quiz questions — ships inside the app. Get TPEE to study it offline.