What ASCII Is
ASCII maps the numbers 0–127 to characters: 0–31 and 127 are control characters, 32–126 are printable. Each code fits in 7 bits, which is why converting text to binary produces 7- or 8-bit groups per character.
Printable Characters (32–126)
| Dec | Hex | Char | Dec | Hex | Char | Dec | Hex | Char |
|---|---|---|---|---|---|---|---|---|
| 32 | 20 | (space) | 64 | 40 | @ | 96 | 60 | ` |
| 33 | 21 | ! | 65 | 41 | A | 97 | 61 | a |
| 34 | 22 | " | 66 | 42 | B | 98 | 62 | b |
| 35 | 23 | # | 67 | 43 | C | 99 | 63 | c |
| 36 | 24 | $ | 68 | 44 | D | 100 | 64 | d |
| 37 | 25 | % | 69 | 45 | E | 101 | 65 | e |
| 38 | 26 | & | 70 | 46 | F | 102 | 66 | f |
| 39 | 27 | ' | 71 | 47 | G | 103 | 67 | g |
| 40 | 28 | ( | 72 | 48 | H | 104 | 68 | h |
| 41 | 29 | ) | 73 | 49 | I | 105 | 69 | i |
| 48 | 30 | 0 | 80 | 50 | P | 112 | 70 | p |
| 49 | 31 | 1 | 81 | 51 | Q | 113 | 71 | q |
| 57 | 39 | 9 | 90 | 5A | Z | 122 | 7A | z |
| 58 | 3A | : | 91 | 5B | [ | 123 | 7B | { |
| 61 | 3D | = | 93 | 5D | ] | 125 | 7D | } |
| 63 | 3F | ? | 95 | 5F | _ | 126 | 7E | ~ |
(Letters and digits are contiguous: A=65, Z=90, a=97, z=122, 0=48, 9=57.)
Two Handy Facts
- Uppercase to lowercase differ by exactly 32 (
A=65,a=97). Flip the 0x20 bit to change case. - Digit to value:
'7'is 55, so subtract 48 ('0') to get the numeric value — the classicchar - '0'trick.
Control Characters (selected)
| Dec | Hex | Name | Meaning |
|---|---|---|---|
| 0 | 00 | NUL | null terminator |
| 9 | 09 | HT | horizontal tab |
| 10 | 0A | LF | line feed (newline on Unix) |
| 13 | 0D | CR | carriage return |
| 27 | 1B | ESC | escape (ANSI sequences) |
| 127 | 7F | DEL | delete |
\r\n (CR+LF, 13+10) is the Windows line ending; Unix uses just \n (10).
ASCII, Unicode, and Binary
ASCII is the first 128 code points of Unicode, and UTF-8 encodes them identically — one byte each. Anything beyond 127 (accents, emoji, CJK) needs multiple bytes in UTF-8. To see a character's bits, convert it with the text to binary tool; for code points beyond ASCII, use text to Unicode.
Frequently Asked Questions
What is the ASCII code for 'A'? 65 in decimal, 0x41 in hex, 1000001 in binary. Lowercase 'a' is 97.
How many characters are in ASCII? 128 (codes 0–127): 33 control characters and 95 printable characters including space.
What is the binary for ASCII letters?
Each ASCII character is 7 bits (often stored in 8). 'A' (65) is 1000001; convert any text to see its bits.
Convert text to its binary representation with the text to binary tool.