What is ASCII?
ASCII (American Standard Code for Information Interchange) is the foundational character encoding that maps numbers 0-127 to letters, digits, and symbols. Created in 1963, it remains the basis for all modern character encodings.
ASCII Code Reference
| Character | Decimal | Description |
|---|---|---|
| A-Z | 65-90 | Uppercase letters |
| a-z | 97-122 | Lowercase letters |
| 0-9 | 48-57 | Digits |
| (space) | 32 | Space character |
🔤 Case Conversion Trick
Uppercase and lowercase letters differ by 32. To convert A→a, add 32 (65→97). This works because ASCII was designed with this relationship intentionally!
Common Uses of ASCII Codes
Programming
Understanding ASCII helps with string manipulation, character comparisons, and encoding issues. Many algorithms work directly with ASCII values.
Keyboard Input
Keyboard events often return ASCII codes. Knowing that Enter is 13, Escape is 27, and space is 32 helps with event handling.
Control Characters
ASCII 0-31 are "control characters" for non-printable functions: tab (9), newline (10), carriage return (13). These control text formatting.
Frequently Asked Questions
What about characters above 127?
Standard ASCII only covers 0-127 (7 bits). Extended ASCII (128-255) varies by system. Modern systems use Unicode/UTF-8 for full international character support.
Why are digits 48-57, not 0-9?
0-31 are reserved for control characters (non-printable). Printable characters start at 32 (space). Digits are placed after various symbols in the ordering.
Is ASCII the same as UTF-8?
UTF-8 is backward compatible with ASCII. Characters 0-127 have identical values in both encodings. UTF-8 extends to support millions more characters.