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.
The shortcut
Memorise three anchors, '0' = 48, 'A' = 65, 'a' = 97, and count from them. Two patterns do the rest: lowercase = uppercase + 32, and digit value = code − 48.
A capital
'G' is 6 letters after 'A': 65 + 6 = 71.
The 32 gap is no accident: 32 is a single bit (2⁵), so switching case just flips that one bit.
Drills
Answer fast — trust the rule.
What is the ASCII code of 'C'?
What is the ASCII code of 'd'?
The character '7' has which ASCII code?
Why can't the word 'café' be stored in plain ASCII?
Remember
- ASCII: 128 characters, codes 0–127, seven bits.
- Anchors: '0' = 48, 'A' = 65, 'a' = 97; lowercase = uppercase + 32.
- The trap: the character '7' is code 55, not the number 7.
