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.

Ad
Ad

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:

DecHexAbbrNameModern Use
000NULNullString terminator in C/C++
707BELBellTerminal beep (\a)
808BSBackspaceDelete previous character (\b)
909HTHorizontal TabTab character (\t)
100ALFLine FeedNewline on Unix/macOS (\n)
130DCRCarriage ReturnNewline on old Mac (\r); Windows uses CR+LF
271BESCEscapeStart of ANSI escape sequences for terminal colours
1277FDELDeleteRarely used in modern systems

Line Endings Across Operating Systems

OSLine EndingHex BytesEscape Sequence
Unix / Linux / macOSLF0A\n
WindowsCR LF0D 0A\r\n
Classic Mac (pre-OS X)CR0D\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:

RangeCharactersPattern
48-570-9Digits start at 48 (0x30)
65-90A-ZUppercase letters start at 65 (0x41)
97-122a-zLowercase letters start at 97 (0x61)
Uppercase to lowercaseA to aAdd 32 (or flip bit 5: 0x20)
Digit to value'5' to 5Subtract 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

LanguageGet Code from CharGet Char from Code
JavaScript"A".charCodeAt(0) = 65String.fromCharCode(65) = "A"
Pythonord("A") = 65chr(65) = "A"
C / C++(int)'A' = 65(char)65 = 'A'
Java(int)'A' = 65(char)65 = 'A'
Goint('A') = 65string(rune(65)) = "A"
Rustb'A' = 65u865u8 as char = 'A'

ASCII vs Unicode and UTF-8

EncodingCharactersBytes per CharacterNotes
ASCII1281 (7 bits)English letters, digits, basic symbols
Extended ASCII (Latin-1)2561 (8 bits)Adds accented characters for Western European languages
UTF-8149,000+1-4Variable width; ASCII characters use 1 byte (backward compatible)
UTF-16149,000+2 or 4Used internally by JavaScript and Java
UTF-32149,000+4Fixed 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

CharacterDecEntityWhy It Needs Encoding in HTML
<60&lt;Opens an HTML tag
>62&gt;Closes an HTML tag
&38&amp;Starts an entity reference
"34&quot;Terminates attribute values
'39&apos;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:

YearEvent
1960ASA X3.2 subcommittee formed to design a universal code
1963ASCII-1963 published (no lowercase letters; codes reserved)
1965IBM announces System/360 using EBCDIC, slowing ASCII adoption
1967ASCII-1967 adds lowercase a-z at codes 97-122
1968US President Lyndon B. Johnson mandates ASCII for federal computers
1986Ratified as ANSI X3.4-1986 (the modern reference spec)
1988Republished as ISO/IEC 646, the international base standard
1991Unicode 1.0 adopts ASCII codes 0-127 unchanged as the first Unicode block
2008UTF-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:

ContextWhere ASCII Appears
Source codeKeywords, identifiers, and punctuation in most languages are ASCII-only by spec
HTTP/1.1Header field names and values are restricted to ASCII (RFC 7230)
DNSDomain labels are ASCII; Unicode names use Punycode to round-trip via ASCII
Email headersRFC 5322 requires ASCII; non-ASCII content is MIME-encoded
URLsRFC 3986 reserves ASCII; other bytes are percent-encoded (%20, %3A, etc.)
JSON / YAML keysParsers accept Unicode but most APIs use ASCII-only keys
File permissionsOctal 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

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.

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>