ASCII Table

Decimal · Hexadecimal · Octal · Binary · Character (0–127)

Complete ASCII character reference for all 128 standard ASCII codes. Search by character, decimal value or hex code. Click any row to copy its reference to clipboard.

Quick fact: The letter A = decimal 65 = hex 0x41 = binary 1000001. Lowercase a = 97 = 0x61 = 1100001. The difference is exactly 32 (0x20) — a single bit flip converts between upper and lower case.
DecHexOctBinaryChar
0000000000000NUL
1010010000001SOH
2020020000010STX
3030030000011ETX
4040040000100EOT
5050050000101ENQ
6060060000110ACK
7070070000111BEL
8080100001000BS
9090110001001HT
100A0120001010LF
110B0130001011VT
120C0140001100FF
130D0150001101CR
140E0160001110SO
150F0170001111SI
16100200010000DLE
17110210010001DC1
18120220010010DC2
19130230010011DC3
20140240010100DC4
21150250010101NAK
22160260010110SYN
23170270010111ETB
24180300011000CAN
25190310011001EM
261A0320011010SUB
271B0330011011ESC
281C0340011100FS
291D0350011101GS
301E0360011110RS
311F0370011111US
32200400100000
33210410100001!
34220420100010"
35230430100011#
36240440100100$
37250450100101%
38260460100110&
39270470100111'
40280500101000(
41290510101001)
422A0520101010*
432B0530101011+
442C0540101100,
452D0550101101-
462E0560101110.
472F0570101111/
483006001100000
493106101100011
503206201100102
513306301100113
523406401101004
533506501101015
543606601101106
553706701101117
563807001110008
573907101110019
583A0720111010:
593B0730111011;
603C0740111100<
613D0750111101=
623E0760111110>
633F0770111111?
64401001000000@
65411011000001A
66421021000010B
67431031000011C
68441041000100D
69451051000101E
70461061000110F
71471071000111G
72481101001000H
73491111001001I
744A1121001010J
754B1131001011K
764C1141001100L
774D1151001101M
784E1161001110N
794F1171001111O
80501201010000P
81511211010001Q
82521221010010R
83531231010011S
84541241010100T
85551251010101U
86561261010110V
87571271010111W
88581301011000X
89591311011001Y
905A1321011010Z
915B1331011011[
925C1341011100\
935D1351011101]
945E1361011110^
955F1371011111_
96601401100000`
97611411100001a
98621421100010b
99631431100011c
100641441100100d
101651451100101e
102661461100110f
103671471100111g
104681501101000h
105691511101001i
1066A1521101010j
1076B1531101011k
1086C1541101100l
1096D1551101101m
1106E1561101110n
1116F1571101111o
112701601110000p
113711611110001q
114721621110010r
115731631110011s
116741641110100t
117751651110101u
118761661110110v
119771671110111w
120781701111000x
121791711111001y
1227A1721111010z
1237B1731111011{
1247C1741111100|
1257D1751111101}
1267E1761111110~
1277F1771111111DEL

Click any row to copy its Dec / Hex / Char reference to clipboard.

What Is ASCII?

ASCII (American Standard Code for Information Interchange) is the oldest and most universally supported character encoding standard in computing. Developed in the early 1960s and first published as a US standard in 1963, ASCII uses 7 bits to represent exactly 128 characters — numbered 0 through 127. Every modern computing system, programming language, network protocol and file format is built on top of ASCII.

ASCII divides into three main groups. Control characters (0–31 and 127) are non-printable codes originally designed to control teletype printers and serial communications — many remain in active use today: 9 (tab), 10 (newline LF on Unix/Linux), 13 (carriage return CR), 27 (escape). Printable characters (32–126) cover space, punctuation, digits 0–9 (codes 48–57), uppercase A–Z (65–90) and lowercase a–z (97–122). The structure is deliberate: digits start at 48 (0x30), letters at 65 (0x41) and 97 (0x61), with exactly 32 (0x20) separating upper from lowercase.

ASCII's 128-character range is sufficient for English but inadequate for other languages. Unicode was created to address this — over 140,000 characters covering every writing system. Critically, UTF-8 (the dominant web encoding, used on over 98% of websites) is fully backward-compatible with ASCII: bytes 0–127 are identical in both encodings, so any pure ASCII file is automatically a valid UTF-8 file.

The case conversion trick: Converting between uppercase and lowercase in ASCII is a single bitwise operation. Add 32 to uppercase to get lowercase (A=65 → a=97), subtract 32 to go the other way. In binary: A=1000001, a=1100001 — only bit 5 (the 0x20 bit) differs. This is why char | 0x20 converts to lowercase and char & ~0x20 converts to uppercase in C.

How to Use the ASCII Table

  1. Search by character — type a letter, digit or symbol (e.g. A or @) in the search box. Matching rows appear instantly.
  2. Search by decimal value — type the decimal code (e.g. 65) to jump directly to that character's row.
  3. Search by hex value — type a hex code (e.g. 41 for A or 20 for space) to find by hexadecimal.
  4. Read all number bases — each row shows the same character in decimal, hexadecimal, octal and binary so you can compare representations side by side.
  5. Click to copy — click any table row to copy its Dec/Hex/Char reference to your clipboard. A confirmation toast appears.
  6. Use quick-reference chips — click the chips in the common values section below to instantly copy the most-used ASCII codes.

ASCII Encoding Explained

ASCII encodes each character as a 7-bit binary integer. The 128 possible values (0–127) are divided into control codes and printable characters. The encoding choices were not arbitrary — they were designed with computing efficiency in mind.

Number base representations

Each ASCII code can be expressed in any number base. The table shows four: decimal (base 10, everyday counting), hexadecimal (base 16, used in programming and memory addresses), octal (base 8, used in Unix file permissions and some legacy systems), and binary (base 2, the actual bit pattern stored in memory).

Converting between them: Decimal 65 → Hex: 65 ÷ 16 = 4 remainder 1 → 0x41. Decimal 65 → Binary: 64+1 = 1000000+1 = 1000001. Decimal 65 → Octal: 65 ÷ 8 = 8 remainder 1, 8 ÷ 8 = 1 remainder 0 → 101.

Digit encoding shortcut

ASCII digits '0'–'9' start at code 48. To get the numeric value of a digit character, subtract 48: '5' = 53, 53 − 48 = 5. In hex: digit '0'=0x30, so digit_value = ascii_code & 0x0F (mask the lower nibble).

URL encoding

URL percent-encoding uses ASCII hex values: space = %20 (hex 20 = decimal 32), @ = %40 (hex 40 = decimal 64), / = %2F (hex 2F = decimal 47). This is why knowing ASCII hex values is essential for web development.

Essential ASCII Codes Quick Reference

The most frequently needed ASCII codes for programmers and developers:

32SP0x20
9TAB0x09
10LF \n0x0A
13CR \r0x0D
27ESC0x1B
0NUL0x00
4800x30
5790x39
65A0x41
90Z0x5A
97a0x61
122z0x7A
34"0x22
39'0x27
64@0x40
127DEL0x7F

Worked Examples

Example 1: Converting "Hi" to ASCII codes

The string "Hi" = H (72) + i (105). In hex: 0x48 0x69. In binary: 1001000 1101001. This is the exact byte sequence stored in memory or sent over a network when you transmit the text "Hi" in ASCII or UTF-8.

Example 2: URL-encoding a string

The URL query string "name=John Doe" must have the space encoded. Space = ASCII 32 = hex 0x20, so it becomes %20. Result: name=John%20Doe. The ampersand (&) = ASCII 38 = 0x26 → %26 when it appears in a value rather than as a separator.

Example 3: Case conversion in C

To lowercase a character in C without using a library: char lower = 'A' | 0x20; gives 'a'. To uppercase: char upper = 'a' & ~0x20; gives 'A'. This works because the only bit difference between uppercase and lowercase ASCII letters is bit 5 (value 32 = 0x20).

Practical Tips for Using ASCII Codes

  • Digit extraction shortcut — to get the integer value of an ASCII digit, use ascii_code - 48 or equivalently ascii_code & 0x0F. Example: '7' = 55, 55 - 48 = 7.
  • Alphabetic range checks — to check if a character is uppercase: c >= 65 && c <= 90. Lowercase: c >= 97 && c <= 122. Digit: c >= 48 && c <= 57.
  • Windows vs Unix line endings — Windows uses CR+LF (13+10, \r\n), Unix/Linux/Mac uses LF only (10, \n). Mixing these causes extra blank lines or ^M characters when reading files across platforms.
  • Null terminator in C — ASCII 0 (NUL) is used to mark the end of a string in C. It is not the same as the character '0' (ASCII 48). Always be aware of this when working with C-style strings.
  • JSON and string escaping — double quote (34, 0x22) must be escaped as \" in JSON strings. Backslash (92, 0x5C) must be escaped as \\. Tab (9) as \t, newline (10) as \n.
  • Regex character classes — [A-Z] matches codes 65–90, [a-z] matches 97–122, [0-9] matches 48–57. These work because ASCII assigns consecutive codes to each range.
  • Base64 encoding — Base64 encodes binary data using ASCII printable characters (A-Z, a-z, 0-9, +, /). The output is always ASCII, making it safe to embed binary data in text-based formats.

Frequently Asked Questions

ASCII (American Standard Code for Information Interchange) is a character encoding standard that uses 7 bits to represent 128 characters (codes 0–127). Developed in the early 1960s, it encodes control characters (0–31), printable characters including letters, digits and symbols (32–126), and the delete character (127). It forms the foundation of modern character encoding systems including UTF-8 and Unicode.

The ASCII code for space is 32 in decimal, 0x20 in hexadecimal, 040 in octal, and 0100000 in binary. It is the first printable ASCII character. In URLs, space is encoded as %20 (its hex value). In programming, you can use ASCII 32 or the space character literal ' '.

Uppercase letters A–Z are ASCII codes 65–90 (0x41–0x5A in hex). Lowercase letters a–z are codes 97–122 (0x61–0x7A). The difference between uppercase and lowercase of the same letter is always 32 (e.g. A=65, a=97, difference=32). In binary, this is simply flipping bit 5 — the 0x20 bit.

ASCII control characters are codes 0–31 (and 127). Originally designed to control teletype machines, key ones still used today: 9=HT (tab, \t), 10=LF (newline \n on Unix/Linux/Mac), 13=CR (carriage return \r, used with LF for Windows line endings), 27=ESC (escape), 0=NUL (null terminator in C strings), 7=BEL (alert/bell).

ASCII defines only 128 characters (0–127) using 7 bits, covering English text. Unicode extends this to over 140,000 characters covering virtually every writing system. UTF-8, the most common Unicode encoding, is fully backward compatible with ASCII — bytes 0–127 in UTF-8 are identical to ASCII. Any pure ASCII file is automatically a valid UTF-8 file.

The ASCII assignment was designed with practical priorities: codes 0–31 for control characters, 32 for space, then punctuation and digits (48–57) before letters. Digits starting at 48 (0x30) means the digit value equals (ASCII code − 48). The 32-unit gap between uppercase (65) and lowercase (97) enables a single bitwise XOR (with 0x20) to toggle case.

Python: ord('A') returns 65; chr(65) returns 'A'. JavaScript: 'A'.charCodeAt(0) returns 65; String.fromCharCode(65) returns 'A'. C/C++: (int)'A' returns 65. Java: (int)'A' returns 65. These conversions are essential for character arithmetic, validation, and encoding operations.