ASCII Table
Reference table for ASCII character codes (0–127): decimal, hex and character.
Back to all tools on ToolForge
Table
| Dec | Hex | Char | Dec | Hex | Char |
|---|
About ASCII Table
This ASCII table lists all 128 standard ASCII character codes (0-127) with decimal, hexadecimal, and character representations. ASCII (American Standard Code for Information Interchange) is the foundational character encoding for modern computing.
ASCII Character Ranges
| Range | Name | Description |
|---|---|---|
| 0-31 | Control characters | Non-printing device control codes |
| 32 | Space | Whitespace character |
| 33-47 | Punctuation | Symbols and punctuation marks |
| 48-57 | Digits | Numeric characters 0-9 |
| 58-64 | Punctuation | More symbols and punctuation |
| 65-90 | Uppercase | Letters A-Z |
| 91-96 | Punctuation | Brackets and symbols |
| 97-122 | Lowercase | Letters a-z |
| 123-126 | Punctuation | Final symbols |
| 127 | DEL | Delete control character |
Key ASCII Control Characters
| Dec | Hex | Name | Description |
|---|---|---|---|
| 0 | 0x00 | NUL | Null character (string terminator in C) |
| 9 | 0x09 | TAB | Horizontal tab |
| 10 | 0x0A | LF | Line feed (newline in Unix) |
| 13 | 0x0D | CR | Carriage return (used in Mac/Windows) |
| 27 | 0x1B | ESC | Escape (starts ANSI escape sequences) |
| 32 | 0x20 | SP | Space (first printable character) |
| 127 | 0x7F | DEL | Delete (rubout) |
ASCII Patterns and Relationships
Useful ASCII Patterns: Digits (0-9): 48-57 (0x30-0x39) - '0' = 48, '1' = 49, ... '9' = 57 - To convert digit char to int: char - 48 or char - '0' Uppercase (A-Z): 65-90 (0x41-0x5A) - 'A' = 65, 'B' = 66, ... 'Z' = 90 Lowercase (a-z): 97-122 (0x61-0x7A) - 'a' = 97, 'b' = 98, ... 'z' = 122 Case Conversion: - Upper to lower: char + 32 - Lower to upper: char - 32 - Using bit ops: char | 0x20 (to lower), char & 0xDF (to upper) Why 32? Bit 5 (0x20) is the case bit: - Uppercase: bit 5 = 0 - Lowercase: bit 5 = 1
ASCII vs Unicode
ASCII is a 7-bit encoding with 128 characters. Unicode is a universal character set supporting all writing systems:
- ASCII range in Unicode: U+0000 to U+007F (identical to ASCII)
- Latin-1 Supplement: U+0080 to U+00FF (extended Latin characters)
- Basic Multilingual Plane: U+0000 to U+FFFF (most common characters)
- Full Unicode: Up to U+10FFFF (over 1 million code points)
UTF-8 encoding is backward-compatible with ASCII - ASCII bytes are valid UTF-8.
Common Use Cases
- Character Encoding: Convert between characters and numeric codes
- Protocol Implementation: Handle control characters in communication protocols
- String Parsing: Identify whitespace, digits, or special characters
- Case Conversion: Implement uppercase/lowercase transformations
- Data Validation: Check if characters are within expected ASCII ranges
- Embedded Systems: Work with limited character sets in constrained environments
Hex to Decimal Conversion
ASCII hex values use base-16. To convert:
- Hex to decimal: (first_digit × 16) + second_digit
- Example: 0x4A = (4 × 16) + 10 = 74 (letter 'J')
- Decimal to hex: divide by 16, use remainder
- Example: 97 ÷ 16 = 6 remainder 1, so 97 = 0x61
How to Use the ASCII Table
- Find decimal code: Locate the decimal value (0-127) in the Dec column.
- Read hex code: The adjacent Hex column shows the hexadecimal equivalent.
- View character: The Char column displays the printable character (blank for control codes).
- Use the code: Apply the ASCII value in your encoding, parsing, or protocol work.
Tips
- Control characters (0-31, 127) don't display - they're device control codes
- Hex values are useful for escape sequences (\x41 = 'A')
- Digits, uppercase, and lowercase are sequential - use math for conversions
- Case differs by bit 5 (0x20) - useful for bit manipulation
Frequently Asked Questions
- What is ASCII and how does it work?
- ASCII (American Standard Code for Information Interchange) is a 7-bit character encoding standard using values 0-127. Each character maps to a unique number: letters (A=65, a=97), digits (0=48), punctuation, and control codes. ASCII enables consistent text representation across systems.
- What are ASCII control characters?
- Control characters (0-31 and 127) are non-printing codes for device control: NUL (0), TAB (9), LF/Line Feed (10), CR/Carriage Return (13), ESC (27), DEL (127). They originated from teletype machines for paper control, not character display.
- Why does ASCII only go up to 127?
- ASCII uses 7 bits, giving 2^7 = 128 possible values (0-127). The 8th bit was originally used for parity checking. Extended ASCII (128-255) uses the full 8 bits but isn't standardized - different systems use different character sets for those values.
- How do I convert between ASCII decimal and hex?
- To convert decimal to hex: divide by 16, use remainder as hex digit. Example: 65 ÷ 16 = 4 remainder 1, so 65 = 0x41. To convert hex to decimal: multiply first digit by 16, add second. Example: 0x4A = (4×16) + 10 = 74.
- What is the relationship between ASCII and Unicode?
- Unicode extends ASCII - the first 128 Unicode code points (U+0000 to U+007F) are identical to ASCII. Unicode adds characters for all world languages, symbols, and emoji in higher ranges (up to U+10FFFF). UTF-8 encoding preserves ASCII compatibility.
- What are common ASCII codes I should memorize?
- Key codes: Space=32, '0'=48 (digits are sequential), 'A'=65 (uppercase sequential), 'a'=97 (lowercase sequential). Uppercase to lowercase differs by 32. These patterns make case conversion and digit extraction simple bit operations.