ASCII Table
Complete ASCII character reference table
Search ASCII Characters
ASCII Character Table
| Dec | Hex | Oct | Binary | Char | Description |
|---|---|---|---|---|---|
| 0 | 0x00 | 000 | 0000000 | · | Control Character |
| 1 | 0x01 | 001 | 0000001 | · | Control Character |
| 2 | 0x02 | 002 | 0000010 | · | Control Character |
| 3 | 0x03 | 003 | 0000011 | · | Control Character |
| 4 | 0x04 | 004 | 0000100 | · | Control Character |
| 5 | 0x05 | 005 | 0000101 | · | Control Character |
| 6 | 0x06 | 006 | 0000110 | · | Control Character |
| 7 | 0x07 | 007 | 0000111 | · | Control Character |
| 8 | 0x08 | 010 | 0001000 | · | Control Character |
| 9 | 0x09 | 011 | 0001001 | · | Control Character |
| 10 | 0x0A | 012 | 0001010 | · | Control Character |
| 11 | 0x0B | 013 | 0001011 | · | Control Character |
| 12 | 0x0C | 014 | 0001100 | · | Control Character |
| 13 | 0x0D | 015 | 0001101 | · | Control Character |
| 14 | 0x0E | 016 | 0001110 | · | Control Character |
| 15 | 0x0F | 017 | 0001111 | · | Control Character |
| 16 | 0x10 | 020 | 0010000 | · | Control Character |
| 17 | 0x11 | 021 | 0010001 | · | Control Character |
| 18 | 0x12 | 022 | 0010010 | · | Control Character |
| 19 | 0x13 | 023 | 0010011 | · | Control Character |
| 20 | 0x14 | 024 | 0010100 | · | Control Character |
| 21 | 0x15 | 025 | 0010101 | · | Control Character |
| 22 | 0x16 | 026 | 0010110 | · | Control Character |
| 23 | 0x17 | 027 | 0010111 | · | Control Character |
| 24 | 0x18 | 030 | 0011000 | · | Control Character |
| 25 | 0x19 | 031 | 0011001 | · | Control Character |
| 26 | 0x1A | 032 | 0011010 | · | Control Character |
| 27 | 0x1B | 033 | 0011011 | · | Control Character |
| 28 | 0x1C | 034 | 0011100 | · | Control Character |
| 29 | 0x1D | 035 | 0011101 | · | Control Character |
| 30 | 0x1E | 036 | 0011110 | · | Control Character |
| 31 | 0x1F | 037 | 0011111 | · | Control Character |
| 32 | 0x20 | 040 | 0100000 | Space | |
| 33 | 0x21 | 041 | 0100001 | ! | Punctuation |
| 34 | 0x22 | 042 | 0100010 | " | Punctuation |
| 35 | 0x23 | 043 | 0100011 | # | Punctuation |
| 36 | 0x24 | 044 | 0100100 | $ | Punctuation |
| 37 | 0x25 | 045 | 0100101 | % | Punctuation |
| 38 | 0x26 | 046 | 0100110 | & | Punctuation |
| 39 | 0x27 | 047 | 0100111 | ' | Punctuation |
| 40 | 0x28 | 050 | 0101000 | ( | Punctuation |
| 41 | 0x29 | 051 | 0101001 | ) | Punctuation |
| 42 | 0x2A | 052 | 0101010 | * | Punctuation |
| 43 | 0x2B | 053 | 0101011 | + | Punctuation |
| 44 | 0x2C | 054 | 0101100 | , | Punctuation |
| 45 | 0x2D | 055 | 0101101 | - | Punctuation |
| 46 | 0x2E | 056 | 0101110 | . | Punctuation |
| 47 | 0x2F | 057 | 0101111 | / | Punctuation |
| 48 | 0x30 | 060 | 0110000 | 0 | Digit |
| 49 | 0x31 | 061 | 0110001 | 1 | Digit |
| 50 | 0x32 | 062 | 0110010 | 2 | Digit |
| 51 | 0x33 | 063 | 0110011 | 3 | Digit |
| 52 | 0x34 | 064 | 0110100 | 4 | Digit |
| 53 | 0x35 | 065 | 0110101 | 5 | Digit |
| 54 | 0x36 | 066 | 0110110 | 6 | Digit |
| 55 | 0x37 | 067 | 0110111 | 7 | Digit |
| 56 | 0x38 | 070 | 0111000 | 8 | Digit |
| 57 | 0x39 | 071 | 0111001 | 9 | Digit |
| 58 | 0x3A | 072 | 0111010 | : | Symbol |
| 59 | 0x3B | 073 | 0111011 | ; | Symbol |
| 60 | 0x3C | 074 | 0111100 | < | Symbol |
| 61 | 0x3D | 075 | 0111101 | = | Symbol |
| 62 | 0x3E | 076 | 0111110 | > | Symbol |
| 63 | 0x3F | 077 | 0111111 | ? | Symbol |
| 64 | 0x40 | 100 | 1000000 | @ | Symbol |
| 65 | 0x41 | 101 | 1000001 | A | Uppercase Letter |
| 66 | 0x42 | 102 | 1000010 | B | Uppercase Letter |
| 67 | 0x43 | 103 | 1000011 | C | Uppercase Letter |
| 68 | 0x44 | 104 | 1000100 | D | Uppercase Letter |
| 69 | 0x45 | 105 | 1000101 | E | Uppercase Letter |
| 70 | 0x46 | 106 | 1000110 | F | Uppercase Letter |
| 71 | 0x47 | 107 | 1000111 | G | Uppercase Letter |
| 72 | 0x48 | 110 | 1001000 | H | Uppercase Letter |
| 73 | 0x49 | 111 | 1001001 | I | Uppercase Letter |
| 74 | 0x4A | 112 | 1001010 | J | Uppercase Letter |
| 75 | 0x4B | 113 | 1001011 | K | Uppercase Letter |
| 76 | 0x4C | 114 | 1001100 | L | Uppercase Letter |
| 77 | 0x4D | 115 | 1001101 | M | Uppercase Letter |
| 78 | 0x4E | 116 | 1001110 | N | Uppercase Letter |
| 79 | 0x4F | 117 | 1001111 | O | Uppercase Letter |
| 80 | 0x50 | 120 | 1010000 | P | Uppercase Letter |
| 81 | 0x51 | 121 | 1010001 | Q | Uppercase Letter |
| 82 | 0x52 | 122 | 1010010 | R | Uppercase Letter |
| 83 | 0x53 | 123 | 1010011 | S | Uppercase Letter |
| 84 | 0x54 | 124 | 1010100 | T | Uppercase Letter |
| 85 | 0x55 | 125 | 1010101 | U | Uppercase Letter |
| 86 | 0x56 | 126 | 1010110 | V | Uppercase Letter |
| 87 | 0x57 | 127 | 1010111 | W | Uppercase Letter |
| 88 | 0x58 | 130 | 1011000 | X | Uppercase Letter |
| 89 | 0x59 | 131 | 1011001 | Y | Uppercase Letter |
| 90 | 0x5A | 132 | 1011010 | Z | Uppercase Letter |
| 91 | 0x5B | 133 | 1011011 | [ | Symbol |
| 92 | 0x5C | 134 | 1011100 | \ | Symbol |
| 93 | 0x5D | 135 | 1011101 | ] | Symbol |
| 94 | 0x5E | 136 | 1011110 | ^ | Symbol |
| 95 | 0x5F | 137 | 1011111 | _ | Symbol |
| 96 | 0x60 | 140 | 1100000 | ` | Symbol |
| 97 | 0x61 | 141 | 1100001 | a | Lowercase Letter |
| 98 | 0x62 | 142 | 1100010 | b | Lowercase Letter |
| 99 | 0x63 | 143 | 1100011 | c | Lowercase Letter |
| 100 | 0x64 | 144 | 1100100 | d | Lowercase Letter |
| 101 | 0x65 | 145 | 1100101 | e | Lowercase Letter |
| 102 | 0x66 | 146 | 1100110 | f | Lowercase Letter |
| 103 | 0x67 | 147 | 1100111 | g | Lowercase Letter |
| 104 | 0x68 | 150 | 1101000 | h | Lowercase Letter |
| 105 | 0x69 | 151 | 1101001 | i | Lowercase Letter |
| 106 | 0x6A | 152 | 1101010 | j | Lowercase Letter |
| 107 | 0x6B | 153 | 1101011 | k | Lowercase Letter |
| 108 | 0x6C | 154 | 1101100 | l | Lowercase Letter |
| 109 | 0x6D | 155 | 1101101 | m | Lowercase Letter |
| 110 | 0x6E | 156 | 1101110 | n | Lowercase Letter |
| 111 | 0x6F | 157 | 1101111 | o | Lowercase Letter |
| 112 | 0x70 | 160 | 1110000 | p | Lowercase Letter |
| 113 | 0x71 | 161 | 1110001 | q | Lowercase Letter |
| 114 | 0x72 | 162 | 1110010 | r | Lowercase Letter |
| 115 | 0x73 | 163 | 1110011 | s | Lowercase Letter |
| 116 | 0x74 | 164 | 1110100 | t | Lowercase Letter |
| 117 | 0x75 | 165 | 1110101 | u | Lowercase Letter |
| 118 | 0x76 | 166 | 1110110 | v | Lowercase Letter |
| 119 | 0x77 | 167 | 1110111 | w | Lowercase Letter |
| 120 | 0x78 | 170 | 1111000 | x | Lowercase Letter |
| 121 | 0x79 | 171 | 1111001 | y | Lowercase Letter |
| 122 | 0x7A | 172 | 1111010 | z | Lowercase Letter |
| 123 | 0x7B | 173 | 1111011 | { | Symbol |
| 124 | 0x7C | 174 | 1111100 | | | Symbol |
| 125 | 0x7D | 175 | 1111101 | } | Symbol |
| 126 | 0x7E | 176 | 1111110 | ~ | Symbol |
| 127 | 0x7F | 177 | 1111111 | · | Delete |
ASCII Reference
Control Characters (0-31)
Non-printable characters used for text control
Printable Characters (32-126)
Letters, digits, punctuation, and symbols
Extended ASCII (128-255)
Not shown - varies by character set
Complete ASCII Reference Guide
Everything you need to know about ASCII — from the 7-bit encoding standard that powers the internet to practical programming tricks used every day.
Understanding ASCII
What ASCII Is
- ASCII (American Standard Code for Information Interchange): developed in 1963 by ANSI
- 7-bit encoding: 128 characters (0–127)
- First 32 characters (0–31): control characters (non-printable) — carriage return, line feed, tab, null, etc.
- Characters 32–126: printable — space, digits, uppercase letters, lowercase letters, punctuation
- Character 127: DEL (delete control code)
- Extended ASCII (8-bit / 128–255): varies by code page — Windows-1252, ISO-8859-1, etc.
- Unicode backward-compatible: all ASCII code points match their Unicode equivalents
- ASCII is the foundation of virtually all modern text encoding
ASCII vs. Modern Encoding
- ASCII: 7-bit, 128 characters — English only
- ISO-8859-1 (Latin-1): 8-bit, 256 characters — Western European languages
- Windows-1252 (CP1252): 8-bit, 256 characters — similar to Latin-1 with extras
- UTF-8: variable 1–4 bytes — covers all 1.1 million Unicode code points
- UTF-8 is ASCII-compatible — single-byte chars 0–127 are identical
- UTF-16: 2–4 bytes per character — used by Windows internally
- ASCII art: text-based images using printable characters arranged in patterns
- ASCII in protocols: HTTP headers, SMTP, FTP, and most internet protocols use ASCII for control sequences
ASCII Reference Charts
Printable ASCII Reference (32–126)
- 32: Space
- 33: ! (exclamation)
- 34: " (double quote)
- 35: # (hash/pound)
- 36: $ (dollar)
- 37: % (percent)
- 38: & (ampersand)
- 39: ' (apostrophe)
- 40: (
- 41: )
- 42: * (asterisk)
- 43: + (plus)
- 44: , (comma)
- 45: - (hyphen)
- 46: . (period)
- 47: / (forward slash)
- 48–57: 0–9 (digits)
- 58: :
- 59: ;
- 60: <
- 61: =
- 62: >
- 63: ?
- 64: @
- 65–90: A–Z (uppercase)
- 91: [
- 92: \ (backslash)
- 93: ]
- 94: ^ (caret)
- 95: _ (underscore)
- 96: ` (backtick)
- 97–122: a–z (lowercase)
- 123: {
- 124: | (pipe)
- 125: }
- 126: ~ (tilde)
Control Characters (0–31 and 127)
- 0: NUL (null) — string terminator in C
- 7: BEL (bell) — terminal beep
- 8: BS (backspace)
- 9: HT (horizontal tab) — \t in code
- 10: LF (line feed) — \n — Unix/Linux line ending
- 13: CR (carriage return) — \r — combined with LF on Windows
- 26: SUB — Ctrl+Z — EOF marker in Windows
- 27: ESC (escape) — terminal control sequences start with \033
- 28–31: FS, GS, RS, US — file/group/record/unit separators (legacy data)
- 127: DEL (delete) — originally sent to delete a character on paper tape
- Unix new line: LF (10) only
- Windows: CRLF (13+10)
- macOS (classic): CR (13) only
- macOS (modern): LF (10)
Decimal / Octal / Hex / Binary Reference
- Digit 0: Dec 48, Oct 060, Hex 0x30, Bin 00110000
- Digit 9: Dec 57, Oct 071, Hex 0x39, Bin 00111001
- Letter A: Dec 65, Oct 0101, Hex 0x41, Bin 01000001
- Letter Z: Dec 90, Oct 0132, Hex 0x5A, Bin 01011010
- Letter a: Dec 97, Oct 0141, Hex 0x61, Bin 01100001
- Letter z: Dec 122, Oct 0172, Hex 0x7A, Bin 01111010
- Space: Dec 32, Oct 040, Hex 0x20, Bin 00100000
- DEL: Dec 127, Oct 0177, Hex 0x7F, Bin 01111111
- Uppercase to lowercase: add 32 (or set bit 5: OR 0x20)
- Lowercase to uppercase: subtract 32 (or clear bit 5: AND ~0x20)
Real-World Applications
Programming & Development
- String operations: ASCII codes determine sort order — 'A' (65) < 'a' (97) < '{' (123)
- Character validation: check code range to classify letters (65–90 or 97–122), digits (48–57), whitespace (≤ 32)
- Input sanitization: reject characters outside printable range (32–126) for plain-text fields
- C/C++ string.h functions (strlen, strcpy) use null terminator (ASCII 0) to end strings
- Bitwise tricks: toggle case with XOR 0x20; check digit with code - 48; escape sequences: \n=10, \t=9, \r=13, \0=0
- File parsing: detect CR/LF vs LF endings by checking for 13 before 10
- Protocol parsing: HTTP, SMTP, FTP headers are ASCII — parse headers byte-by-byte
Networking & Protocols
- HTTP: request/response headers are ASCII text; body can be any encoding
- SMTP email: headers in ASCII; body in UTF-8 with quoted-printable or base64 encoding
- FTP commands: ASCII control channel (PORT, PASV, LIST are text commands)
- SSH session negotiation: SSH_MSG codes are ASCII-based negotiation strings
- Base64: converts binary to printable ASCII (A–Z, a–z, 0–9, +, /) for safe transport in text protocols
- URL encoding: non-ASCII chars → %XX hex (e.g., space → %20)
- JSON: must use Unicode escapes for non-ASCII in strict ASCII transport
- Serial communication: older protocols (Modbus ASCII, NMEA 0183 GPS) use ASCII framing
Data Processing & CSV
- CSV parsing: delimiter (44=comma), quote (34=double-quote), newline (10=LF) define the format
- TSV: tab (9=HT) as delimiter — avoids conflicts with commas in data
- ASCII sort order: numbers before uppercase before lowercase (0–9, A–Z, a–z)
- String comparison in databases: case-sensitive vs case-insensitive depends on ASCII ordering
- Regex character classes: [A-Z] uses ASCII ranges 65–90; [0-9] uses 48–57
- Data validation: enforce plain-ASCII input for passwords, usernames, or codes that must be portable
- Checksums: simple XOR checksum of ASCII bytes used in NMEA, Modbus, and legacy protocols
- Configuration files: INI, .env, requirements.txt all use ASCII-safe keys and values
Security & Encoding
- SQL injection: ASCII knowledge helps understand why '; (39,59) and -- (45,45) are dangerous
- XSS: characters < (60), > (62), & (38), " (34), ' (39) must be HTML-escaped
- Command injection: ; (59), | (124), & (38), ` (96), $ (36) are shell metacharacters
- URL encoding: all non-ASCII (and many ASCII) must be percent-encoded in URLs
- Base64 encoding: converts binary secrets to printable ASCII for safe storage in env files
- JWT tokens: header+payload encoded as Base64URL (URL-safe ASCII only)
- CSV injection: = (61) and @ (64) as first char trigger formula execution in spreadsheets
- Log injection: newline characters (10, 13) in user input can forge log entries
Best Practices
Working with ASCII in Code
- Always specify encoding explicitly — don't rely on system defaults (utf-8 in Python, UTF-8 in Java)
- Use character literals instead of magic numbers: '\n' instead of 10, 'a' instead of 97
- When comparing characters, be case-aware: 'A' and 'a' differ by exactly 32 in ASCII
- Null-terminate C strings explicitly — forgetting NUL (0) causes buffer overruns
- For network protocols, always use ASCII-safe encoding for header values
- In databases, use UTF-8 column collation — MySQL's utf8 is broken, use utf8mb4
- Validate character ranges for security-sensitive inputs (usernames, filenames, API keys)
- When generating random tokens, use only URL-safe ASCII: A–Z, a–z, 0–9, -, _
Encoding Pitfalls to Avoid
- Don't assume ASCII — modern text is Unicode
- strlen() in C counts bytes, not characters for multi-byte UTF-8
- Don't use + for space encoding in URLs unless in query strings — use %20 in paths
- Don't confuse code pages — Windows-1252 and ISO-8859-1 differ at positions 128–159
- Avoid assuming line endings — use \n on Unix, normalize CRLF to LF when reading cross-platform files
- Don't use ASCII art in source code comments if the source file is UTF-8 — use Unicode box-drawing characters instead
- Base64 padding = chars can confuse URL parsers — use Base64URL for URL embedding
- Don't truncate UTF-8 strings by byte count — you may split a multi-byte character
Code Examples
Common Character Lookups
- Check if char is digit: c >= 48 && c <= 57 (or c >= '0' && c <= '9')
- Check if uppercase: c >= 65 && c <= 90
- Check if lowercase: c >= 97 && c <= 122
- Convert digit char to int: c - 48 (e.g., '7' = 55, 55-48 = 7)
- Toggle case: c ^ 32 (e.g., 'A'=65, 65^32=97='a')
- Newline detection: c == 10 (LF) or c == 13 (CR)
- Tab detection: c == 9
- Printable check: c >= 32 && c <= 126
Protocol ASCII Usage
- HTTP GET request start: 47 45 54 20 = "GET "
- HTTP status 200: 50 30 30 = "200"
- SMTP HELO command: 72,69,76,79,32 = "HELO "
- Base64 alphabet starts: A=65, B=66 ... Z=90, a=97 ... z=122, 0=48 ... 9=57, +=43, /=47
- URL space encoding: space(32) → %20
- URL ampersand: &(38) → %26
- JSON quote: "(34) → \"
- CSV comma: ,(44) separates fields; CSV newline: LF(10) separates rows
ASCII Art & Creative Use
- Box drawing (Extended ASCII): ─│┌┐└┘├┤┬┴┼ — used in terminal UIs
- Simple box: corners use + (43), sides use - (45) and | (124)
- Arrow in ASCII: --> (45,45,62) or <-- (60,45,45)
- Emoji precursor: :-) = 58,45,41; :( = 58,40
- Progress bar: [####----] using # (35), - (45), [ (91), ] (93)
- Divider line: =============== using = (61)
- Terminal colors: \033[31m = ESC + [ + 3 + 1 + m = red text
- Stars/borders: * (42) rows for attention-grabbing text
Frequently Asked Questions
What is the difference between ASCII and Unicode?▾
ASCII is a 7-bit encoding with 128 characters covering English letters, digits, and basic punctuation. Unicode is a universal standard covering 1.1 million code points for all the world's writing systems — emoji, Chinese, Arabic, math symbols, and everything else. UTF-8 is the most common Unicode encoding and is backward-compatible with ASCII: the first 128 UTF-8 code points are byte-for-byte identical to ASCII.
Why do uppercase and lowercase letters differ by 32?▾
ASCII was designed so that case conversion is a single bit flip. Uppercase letters start at 65 (01000001), lowercase at 97 (01100001). The difference is exactly 32, which is the value of bit 5 (0x20). To convert uppercase to lowercase: set bit 5 (OR 0x20). To convert lowercase to uppercase: clear bit 5 (AND ~0x20 or AND 0xDF). This was intentional — it makes case conversion extremely efficient in hardware.
What are CRLF and LF and why do they matter?▾
Line endings are ASCII control characters: LF (Line Feed, code 10, \n) on Unix/Linux/macOS, and CRLF (Carriage Return + Line Feed, codes 13+10, \r\n) on Windows. This difference causes files created on one OS to display incorrectly on another — a common source of bugs when sharing files or running cross-platform code. Git can normalize line endings with core.autocrlf = true.
Why does the space character have code 32?▾
ASCII was designed around teletype machines and punched cards. Control codes (0–31) came first for machine control. Printable characters start at 32 because 32 = 00100000 in binary — the first value with bit 5 set. The designers placed space at 32 so it sorts before any printable character, which is useful: ' ' < '0' < 'A' < 'a' in ASCII order.
What is Base64 and how does it relate to ASCII?▾
Base64 encodes arbitrary binary data as printable ASCII text using only 64 safe characters: A–Z, a–z, 0–9, +, /. This allows binary data (images, files, cryptographic keys) to be safely transmitted in text-only contexts like email, JSON, HTML attributes, and URL query strings. Each 3 bytes of binary data become 4 ASCII characters, making Base64-encoded data about 33% larger than the original.
Can I use ASCII codes in JavaScript?▾
Yes. String.fromCharCode(65) returns 'A'. 'A'.charCodeAt(0) returns 65. For Unicode beyond ASCII, use String.fromCodePoint(128512) for emoji (😀). charCodeAt() returns the UTF-16 code unit — for characters above U+FFFF (like most emoji), use codePointAt() instead. In template literals, use \u0041 for 'A' or \u{1F600} for 😀.