Why Computers See 'A' as 65: The ASCII Encoding Guide
This article explains ASCII encoding, the standard that maps 128 characters to numbers 0-127, detailing control codes, printable characters, extended ASCII, programming applications like character comparison and case conversion, and why ASCII's English-only limitation led to Unicode.
What Is ASCII?
ASCII (American Standard Code for Information Interchange) assigns a numeric code to each English character. For example:
'A' → 65
'B' → 66
'a' → 97
'0' → 48
Space → 32
Computers store the binary representation of the code, not the symbol itself. The letter "A" is stored as 01000001 (binary for 65). When reading, the computer sees 01000001, converts to 65, looks up the ASCII table, and displays "A". Encoding = character to number (storage); decoding = number to character (display).
ASCII Table Overview
ASCII defines 128 characters (codes 0-127), fitting in 7 bits.
Control Characters (0-31 and 127)
These are non-printable codes used to control devices:
0 (NUL) – Null character
7 (BEL) – Bell (makes terminal beep)
8 (BS) – Backspace
9 (TAB) – Horizontal tab
10 (LF) – Line feed (\n)
13 (CR) – Carriage return (\r)
27 (ESC) – Escape
127 (DEL) – Delete
Printable Characters (32-126)
Visible characters grouped by code ranges:
32 – Space
33 – !
34 – "
40-41 – ( )
42-47 – * + , - . /
48-57 – Digits 0-9
65-90 – Uppercase A-Z
91-96 – [ ] ^ _ `
97-122 – Lowercase a-z
123-126 – { | } ~
Key ASCII Codes to Remember
'A' = 65 (uppercase letters start at 65)
'a' = 97 (lowercase letters start at 97)
'0' = 48 (digit characters start at 48)
Space = 32
Newline (\n) = 10
Important pattern: Uppercase 'A' (65) and lowercase 'a' (97) differ by 32. Therefore case conversion is simply adding or subtracting 32. Both uppercase and lowercase letters are contiguous sequences.
Extended ASCII (128-255)
Standard ASCII uses only 7 bits; the 8th bit in a byte was later used to define codes 128-255 for extra symbols and European accented characters. Examples:
130 → é (French e with acute)
169 → © (copyright sign)
176 → ° (degree sign)
Different vendors and countries assigned different meanings to the same extended codes, causing incompatibility. This chaos was one reason Unicode was created.
ASCII in Programming
Character Comparison
Comparing characters compares their ASCII values:
'A' < 'B' → 65 < 66 → true
'a' > 'A' → 97 > 65 → true
'0' < '9' → 48 < 57 → trueCharacter and Integer Conversion (C)
char c = 'A'; // c holds 65
int n = c + 1; // n becomes 66, which is 'B'Case Conversion
char c = 'A'; // 65
char lower = c + 32; // 97, which is 'a'Limitations of ASCII
ASCII only supports English. It lacks:
Chinese characters
Japanese, Korean scripts
Arabic, Cyrillic scripts
Chinese punctuation (。 , !)
Before Unicode, Chinese systems used multi-byte encodings like GB2312 and GBK, which extended ASCII by using two bytes per Chinese character.
Fun Fact: ASCII 42
Code 42 is the asterisk *. In Douglas Adams' The Hitchhiker's Guide to the Galaxy , 42 is the "Answer to the Ultimate Question of Life, the Universe, and Everything" – a deliberate programmer joke.
Conclusion
ASCII is the foundational character encoding: computers don't understand characters, only numbers. Every character is encoded into a number for storage. Grasping this concept makes learning Unicode, UTF-8, and GBK much easier.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Learning Made Simple
Learn IT: using simple language and everyday examples to study.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
