ASCII Table
Complete ASCII table showing decimal, hex, octal, binary, and character codes for all 128 values. Searchable, filterable, click to copy.
This interactive ASCII table shows all 128 characters (codes 0-127) with decimal, hexadecimal, octal, binary, and HTML entity values. Search by code, character, or name. Filter between control characters and printable characters. Click any row to copy the character to your clipboard. The reference covers every code from NUL (0) through DEL (127), the 33 control codes, the 94 printable glyphs, and the space.
About ASCII Table
What Is ASCII?
ASCII (American Standard Code for Information Interchange) is a 7-bit character encoding that maps 128 numeric codes to letters, digits, punctuation, and control signals. The American Standards Association published the first version as standard X3.4 on June 17, 1963, with a revision in 1967 that finalised the lowercase letters. ANSI ratified it as ANSI X3.4-1986, and ECMA/ISO republished it as ISO/IEC 646 with national variants. Every modern encoding on the web - UTF-8, UTF-16, Windows-1252, Latin-1 - keeps codes 0-127 identical to ASCII, which is why plain ASCII text is always valid UTF-8 with the same byte values.
Control Characters (0-31 and 127)
Codes 0-31 and 127 are non-printable control characters designed to drive teletypewriters, printers, and terminals. Most are obsolete today, but eight remain in daily use - newlines, tabs, bell, backspace, escape, and the string terminator:
| Dec | Hex | Abbr | Name | Modern Use |
|---|---|---|---|---|
| 0 | 00 | NUL | Null | String terminator in C/C++ |
| 7 | 07 | BEL | Bell | Terminal beep (\a) |
| 8 | 08 | BS | Backspace | Delete previous character (\b) |
| 9 | 09 | HT | Horizontal Tab | Tab character (\t) |
| 10 | 0A | LF | Line Feed | Newline on Unix/macOS (\n) |
| 13 | 0D | CR | Carriage Return | Newline on old Mac (\r); Windows uses CR+LF |
| 27 | 1B | ESC | Escape | Start of ANSI escape sequences for terminal colours |
| 127 | 7F | DEL | Delete | Rarely used in modern systems |
Line Endings Across Operating Systems
| OS | Line Ending | Hex Bytes | Escape Sequence |
|---|---|---|---|
| Unix / Linux / macOS | LF | 0A | \n |
| Windows | CR LF | 0D 0A | \r\n |
| Classic Mac (pre-OS X) | CR | 0D | \r |
Line ending mismatches are a common source of bugs when sharing files between Windows and Unix systems. Git can auto-convert line endings with the core.autocrlf setting.
Printable Characters (32-126)
The 95 printable characters include the space (32), digits 0-9 (48-57), uppercase A-Z (65-90), lowercase a-z (97-122), and 32 punctuation/symbol characters. Some useful patterns:
| Range | Characters | Pattern |
|---|---|---|
| 48-57 | 0-9 | Digits start at 48 (0x30) |
| 65-90 | A-Z | Uppercase letters start at 65 (0x41) |
| 97-122 | a-z | Lowercase letters start at 97 (0x61) |
| Uppercase to lowercase | A to a | Add 32 (or flip bit 5: 0x20) |
| Digit to value | '5' to 5 | Subtract 48 (char - '0') |
The 32-offset between uppercase and lowercase is by design - it means case conversion is a single bit flip (XOR with 0x20). This is why bit 5 is sometimes called the "case bit".
ASCII in Programming Languages
| Language | Get Code from Char | Get Char from Code |
|---|---|---|
| JavaScript | "A".charCodeAt(0) = 65 | String.fromCharCode(65) = "A" |
| Python | ord("A") = 65 | chr(65) = "A" |
| C / C++ | (int)'A' = 65 | (char)65 = 'A' |
| Java | (int)'A' = 65 | (char)65 = 'A' |
| Go | int('A') = 65 | string(rune(65)) = "A" |
| Rust | b'A' = 65u8 | 65u8 as char = 'A' |
ASCII vs Unicode and UTF-8
| Encoding | Characters | Bytes per Character | Notes |
|---|---|---|---|
| ASCII | 128 | 1 (7 bits) | English letters, digits, basic symbols |
| Extended ASCII (Latin-1) | 256 | 1 (8 bits) | Adds accented characters for Western European languages |
| UTF-8 | 149,000+ | 1-4 | Variable width; ASCII characters use 1 byte (backward compatible) |
| UTF-16 | 149,000+ | 2 or 4 | Used internally by JavaScript and Java |
| UTF-32 | 149,000+ | 4 | Fixed width, simple but wasteful |
UTF-8 is backward compatible with ASCII - any valid ASCII text is also valid UTF-8 with the same byte values. This is why UTF-8 became the dominant encoding for the web (used by over 98% of websites as of 2024).
HTML Entities for Special Characters
| Character | Dec | Entity | Why It Needs Encoding in HTML |
|---|---|---|---|
| < | 60 | < | Opens an HTML tag |
| > | 62 | > | Closes an HTML tag |
| & | 38 | & | Starts an entity reference |
| " | 34 | " | Terminates attribute values |
| ' | 39 | ' | Terminates single-quoted attributes |
How Do I Convert a Character to Its ASCII Code by Hand?
Every ASCII character has a fixed decimal number in the range 0-127 that never changes across platforms. The quickest manual method is to find the character's row in the printable block (32-126) and read off the decimal column. For a programming-style conversion, the four bases (decimal, hexadecimal, octal, binary) all encode the same integer, just in different radixes.
Worked example - converting the letter "K":
- Look up K: decimal 75
- Hex: 75 / 16 = 4 remainder 11 (B), so 0x4B
- Octal: 75 / 8 = 9 remainder 3, 9 / 8 = 1 remainder 1, so 113
- Binary: 75 = 64 + 8 + 2 + 1 = 01001011
All four representations store the same byte in memory. The Hex to Decimal Converter can verify each step, and the Binary to Decimal Converter checks the 8-bit representation. For converting whole strings at once, the Text to Binary tool streams each character through the same lookup.
History and Standardisation
ASCII evolved directly from telegraph codes. The American Standards Association's X3.2 subcommittee began work in 1960 under Bob Bemer (often called "the father of ASCII") to replace the dozens of incompatible 5-bit and 6-bit codes used by teleprinter manufacturers. The first formal release landed on June 17, 1963. Key milestones:
| Year | Event |
|---|---|
| 1960 | ASA X3.2 subcommittee formed to design a universal code |
| 1963 | ASCII-1963 published (no lowercase letters; codes reserved) |
| 1965 | IBM announces System/360 using EBCDIC, slowing ASCII adoption |
| 1967 | ASCII-1967 adds lowercase a-z at codes 97-122 |
| 1968 | US President Lyndon B. Johnson mandates ASCII for federal computers |
| 1986 | Ratified as ANSI X3.4-1986 (the modern reference spec) |
| 1988 | Republished as ISO/IEC 646, the international base standard |
| 1991 | Unicode 1.0 adopts ASCII codes 0-127 unchanged as the first Unicode block |
| 2008 | UTF-8 overtakes ASCII as the most common web encoding |
Per W3Techs, UTF-8 is used by 98.9% of websites as of April 2026, and 99.9% of the top 1,000 sites. Because UTF-8 is a strict superset of ASCII, every one of those pages still speaks ASCII fluently - the lookup table on this page is the exact byte values those pages emit for English letters, digits, and punctuation.
Why Is ASCII Still Relevant?
ASCII is still the lingua franca of file formats, protocols, and source code. Even modern stacks that nominally support full Unicode (HTTP/2, JSON, YAML, INI, CSV, RFC 5322 email headers) restrict header names, keywords, and structural tokens to the ASCII subset for parsing simplicity and round-trip safety. A few places where ASCII turns up every day:
| Context | Where ASCII Appears |
|---|---|
| Source code | Keywords, identifiers, and punctuation in most languages are ASCII-only by spec |
| HTTP/1.1 | Header field names and values are restricted to ASCII (RFC 7230) |
| DNS | Domain labels are ASCII; Unicode names use Punycode to round-trip via ASCII |
| Email headers | RFC 5322 requires ASCII; non-ASCII content is MIME-encoded |
| URLs | RFC 3986 reserves ASCII; other bytes are percent-encoded (%20, %3A, etc.) |
| JSON / YAML keys | Parsers accept Unicode but most APIs use ASCII-only keys |
| File permissions | Octal ASCII digits (e.g. 0755) represent Unix permission bitfields |
| Regex character classes | [a-z] and [A-Z] rely on contiguous ASCII letter ranges |
ASCII Art and Historic Uses
Before GUIs, ASCII was the entire graphical toolkit. Usenet signatures, README banners, and early online games rendered everything in the 95 printable glyphs. Figlet (1991) turned short text into large banner headers; BBS systems used ANSI escape sequences to colour ASCII into crude bitmaps. The slash-dot-pipe-underscore repertoire is still the fallback for CLI spinners, ASCII tables in docs, and plain-text logs - the same 95 symbols this page lists in the printable block.
Common Mistakes and Edge Cases
A handful of ASCII pitfalls keep turning up in real-world code:
- "ASCII" vs "ANSI": Windows developers often say "ANSI" when they mean Windows-1252, the 8-bit extension. True ASCII is 7-bit; bytes 128-255 are not ASCII.
- Curly quotes in "ASCII" files: Word processors silently substitute the ASCII straight quotes (0x22, 0x27) with Unicode curly quotes (U+201C, U+2018) that break shell scripts and CSV parsers. The HTML Entity Encoder catches these.
- Line ending mismatches: A git repo cloned on Windows can replace Unix LF with CRLF. Configure core.autocrlf or add a .gitattributes file with text eol=lf for scripts.
- Assuming strlen == character count: In UTF-8, a 3-byte emoji counts as 1 character but 3 bytes. Use code-point-aware length functions for user-facing counts.
- Base64 confusion: Base64 is an ASCII-safe wrapper around arbitrary bytes, not an encoding of the text itself. "Hello" Base64-encoded is "SGVsbG8=", which is still 5 ASCII letters plus padding. The Base64 Encoder/Decoder shows the round-trip.
- Control characters in logs: Injecting raw 0x1B (ESC) into log output can spoof ANSI colours and hide text. Strip or escape control codes before logging untrusted input.
Sources
- RFC 20 - ASCII format for network interchange
- ISO/IEC 646:1991 - Information technology 7-bit coded character set
- Unicode Consortium - C0 Controls and Basic Latin code chart
- W3Techs - Character encoding usage statistics
- MDN - HTML character reference
- RFC 3629 - UTF-8, a transformation format of ISO 10646
All data is generated and filtered locally in your browser - nothing is sent to a server.
Frequently Asked Questions
What is ASCII?
ASCII (American Standard Code for Information Interchange) is a character encoding standard that assigns numeric codes 0 through 127 to letters, digits, punctuation, and control characters. It was first published in 1963 and remains the foundation of most modern text encoding systems including UTF-8.
What are control characters?
ASCII codes 0 through 31 and code 127 are control characters. They were originally designed to control hardware devices like printers and terminals. Common examples include NUL (0), TAB (9), LF or line feed (10), CR or carriage return (13), and ESC (27). Most are rarely used today outside of terminal emulation.
What is the difference between ASCII and Unicode?
ASCII covers 128 characters using 7 bits. Unicode is a much larger standard that covers over 149,000 characters across scripts from around the world. The first 128 Unicode code points are identical to ASCII, so ASCII text is valid UTF-8 by default.
Why does the table show HTML entities?
Some ASCII characters have special meaning in HTML (for example, less-than and greater-than signs, ampersand, and quotation marks). HTML entities provide a way to display these characters literally on a web page without the browser interpreting them as markup. The table shows the entity where one exists.
How do I use the click-to-copy feature?
Click any row in the table to copy the character for that ASCII code to your clipboard. A brief notification confirms the copy. This works for printable characters. For control characters the abbreviated name (like NUL, TAB, LF) is copied instead.
Related Tools
Link to this tool
Copy this HTML to link to this tool from your website or blog.
<a href="https://toolboxkit.io/tools/ascii-table/" title="ASCII Table - Free Online Tool">Try ASCII Table on ToolboxKit.io</a>