ASCII Code Table
ASCII (American Standard Code for Information Interchange) includes 128 characters (0-127). Codes 0-31 and 127 are control characters; 32-126 are printable characters.
How It Works
ASCII (American Standard Code for Information Interchange) encodes characters in 7 bits, giving code points 0–127, and became the de-facto standard for early computers. Code points 0–31 and 127 are control characters (e.g. LF, TAB, CR); 32–126 are printable (letters, digits, punctuation).
Because 7 bits only covers English, "extended ASCII" uses the 8th bit for 128–255, but that range has no single standard — Windows-1252, ISO-8859-1 and others disagree, which is why raw binary text often shows mojibake across systems.
When to Use This Table
This table is for mapping a character to its code point and byte. Debugging mojibake, validating an encoding conversion, or checking control-character numbers in a protocol all need it. But there is a prerequisite question: if your goal is human-readable text, the encoding scheme (UTF-8 / GBK / Shift-JIS) determines the outcome far more than the code point does; this ASCII table only matters once you are working at the byte level.
When not to consult it: you are handling Chinese, Japanese or emoji. This table covers the 7-bit 0-127 range; everything above 128 is extension territory interpreted differently by each encoding, so deriving non-ASCII bytes from this table is guaranteed to be wrong. Those questions belong to the Character Encodings page, not here.
Rule of thumb: consult this table when the number is 0-127 and you need to know what the byte means. Above 127, settle the encoding scheme first and only then talk code points. Conflating the two layers is the most common source of the mistake where a UTF-8 multi-byte sequence gets treated as several separate characters.
Another bad signal: you only want to know the length of a string. Character count, byte count and code point count are three different quantities. They coincide inside ASCII and diverge sharply outside it — a single emoji is typically one character, two code points and four UTF-8 bytes.
Boundaries and Common Pitfalls
Control character numbering varies by dialect
The 0-31 and 127 range is control territory, but the mapping from number to action differs by dialect. Traditional ASCII assigns 7 to bell, 8 to backspace, 9 to tab, 10 to line feed and 13 to carriage return, while Windows consoles make backspace 8 and a newline the two-byte sequence 13 followed by 10. When writing a protocol across systems, never assume that 10 means newline; state which convention you are speaking.
There is no such thing as "extended ASCII"
The 128-255 range is often called extended ASCII, but no single standard defines it. ISO-8859-1 (Latin-1) and Windows-1252 differ only across 0x80-0x9F, which is exactly the boundary between control and printable characters, so mixing them up makes an invisible position render as a glyph. This is the usual reason legacy systems show odd characters in some locales.
A code point is not a glyph
The Unicode basic plane reserves many code points purely for visual compatibility with existing characters, including 494 compatibility characters that collapse under normalization. U+2126 OHM SIGN normalises to U+03A9 GREEK CAPITAL OMEGA; the U+FB01 ligature expands to two letters. Any exact string comparison, deduplication or validation that skips normalisation will treat visually identical strings as different.
Mixing hexadecimal and decimal is the most common conversion slip
Code point 0x41 and 65 denote the same character A. Treating a hex value as decimal (or the reverse) yields an entirely unrelated character and raises no error, because the number itself is perfectly valid in JS. A good sanity check is the resulting string length: printable ASCII sits in 0x20-0x7E, so a decimal value outside that range is proof of a base mix-up somewhere.
How This Relates to Neighbours
For the byte structure and conversion relationships of GBK / Big5 / Shift-JIS / UTF-8, use the Character Encodings page; this one only covers the 7-bit 0-127 base range.
For code points, names and search across emoji and symbols, use the Emoji page, which is organised by code point rather than decimal.
Percent-encoding in URLs (%20, %E4%B8%AD) is a hexadecimal view of UTF-8 bytes — a different layer from character code points. Use the in-site URL encoding tools for that.
If the goal is debugging mojibake in production, the Character Encodings section on writer/reader encoding mismatch will locate the problem faster than any code point table.
Practical Snippet
Key points: (1) [...s] counts code points while s.length counts UTF-16 code units, so an emoji counts as 2 — any length limit gives a different verdict depending on which you use; (2) TextEncoder yields UTF-8 byte counts regardless of the real target encoding, so GBK needs separate calculation; (3) pair codePointAt with String.fromCodePoint and avoid charCodeAt, which returns only the leading surrogate half of a pair.
// 字符串的三个长度:字符 / 码点 / UTF-8 字节
const s = 'A中🛠'
// ① 码点数(用 [...s] 而非 s.length,emoji 会被算成 2)
const codePoints = [...s].length
// ② UTF-8 字节数(TextEncoder 按标准编码,中文 3 字节、emoji 4 字节)
const bytes = new TextEncoder().encode(s).length
// ③ 各层长度对照 —— ASCII 范围内三者一致,超出后迅速发散
console.log({ charLength: s.length, codePoints, bytes })
// 码点 ↔ 字符:用 codePointAt 而非 charCodeAt(后者取不到代理对的后半)
const back = String.fromCodePoint(0x1f6e0) // 🛠
const cp = back.codePointAt(0)
/* 典型结果:
{ charLength: 5, codePoints: 3, bytes: 8 }
charLength 用 UTF-16 计数单位,中文 1、emoji 2,所以是 5;
码点 3('A'、'中'、'🛠');UTF-8 字节 1+3+4 = 8。
⇒ 涉及长度上限(DB 字段、协议头)时必须明确用哪一种口径。 */Practical Notes
- CRLF vs LF causes phantom blank linesWindows text uses CRLF (13, 10) while Unix uses LF (10). Read a CRLF file as Unix and every line ends with a stray \r, so $ anchors fail to match and string comparisons differ. Normalize line endings at the boundary.
- Control characters must be escaped in JSON and URLsCode points 0–31 become \u0000–\u001f in JSON and percent-encoded in URLs (a tab is %09). Inlining them raw makes parsers error out or truncate the message, which happens constantly in log pipelines.
- DEL (127) is not printableIt sits in the control range, is usually invisible in a terminal, and still consumes one byte. Visible-length counters must exclude 0–31 and 127 or they overcount, and input validation should reject those code points explicitly.
Data Sources
- ANSI X3.4-1986
- ISO/IEC 646
- Unicode Standard (C0/C1 controls)
Codes, names and definitions above come from public specifications; we claim no originality over the specification data itself. The arrangement, Chinese annotations and practical notes on this page are written by us.
| DEC | HEX | Char | Name | Chinese Name |
|---|---|---|---|---|
| 0 | 0x00 | NUL | Null | 空字符 |
| 1 | 0x01 | SOH | Start of Heading | 标题开始 |
| 2 | 0x02 | STX | Start of Text | 正文开始 |
| 3 | 0x03 | ETX | End of Text | 正文结束 |
| 4 | 0x04 | EOT | End of Transmission | 传输结束 |
| 5 | 0x05 | ENQ | Enquiry | 询问 |
| 6 | 0x06 | ACK | Acknowledge | 确认 |
| 7 | 0x07 | BEL | Bell | 响铃 |
| 8 | 0x08 | BS | Backspace | 退格 |
| 9 | 0x09 | HT | Horizontal Tab | 水平制表 |
| 10 | 0x0A | LF | Line Feed | 换行 |
| 11 | 0x0B | VT | Vertical Tab | 垂直制表 |
| 12 | 0x0C | FF | Form Feed | 换页 |
| 13 | 0x0D | CR | Carriage Return | 回车 |
| 14 | 0x0E | SO | Shift Out | 移出 |
| 15 | 0x0F | SI | Shift In | 移入 |
| 16 | 0x10 | DLE | Data Link Escape | 数据链路转义 |
| 17 | 0x11 | DC1 | Device Control 1 | 设备控制1 |
| 18 | 0x12 | DC2 | Device Control 2 | 设备控制2 |
| 19 | 0x13 | DC3 | Device Control 3 | 设备控制3 |
| 20 | 0x14 | DC4 | Device Control 4 | 设备控制4 |
| 21 | 0x15 | NAK | Negative Acknowledge | 否定确认 |
| 22 | 0x16 | SYN | Synchronous Idle | 同步空闲 |
| 23 | 0x17 | ETB | End of Trans. Block | 传输块结束 |
| 24 | 0x18 | CAN | Cancel | 取消 |
| 25 | 0x19 | EM | End of Medium | 介质结束 |
| 26 | 0x1A | SUB | Substitute | 替换 |
| 27 | 0x1B | ESC | Escape | 转义 |
| 28 | 0x1C | FS | File Separator | 文件分隔符 |
| 29 | 0x1D | GS | Group Separator | 组分隔符 |
| 30 | 0x1E | RS | Record Separator | 记录分隔符 |
| 31 | 0x1F | US | Unit Separator | 单元分隔符 |
| 32 | 0x20 | SP | Space | 空格 |
| 33 | 0x21 | ! | Exclamation Mark | 感叹号 |
| 34 | 0x22 | " | Quotation Mark | 双引号 |
| 35 | 0x23 | # | Number Sign | 井号 |
| 36 | 0x24 | $ | Dollar Sign | 美元符号 |
| 37 | 0x25 | % | Percent Sign | 百分号 |
| 38 | 0x26 | & | Ampersand | 与号 |
| 39 | 0x27 | ' | Apostrophe | 单引号 |
| 40 | 0x28 | ( | Left Parenthesis | 左括号 |
| 41 | 0x29 | ) | Right Parenthesis | 右括号 |
| 42 | 0x2A | * | Asterisk | 星号 |
| 43 | 0x2B | + | Plus Sign | 加号 |
| 44 | 0x2C | , | Comma | 逗号 |
| 45 | 0x2D | - | Hyphen | 连字符 |
| 46 | 0x2E | . | Period | 句点 |
| 47 | 0x2F | / | Slash | 斜杠 |
| 48 | 0x30 | 0 | Digit Zero | 数字 0 |
| 49 | 0x31 | 1 | 1 | 1 |
| 50 | 0x32 | 2 | 2 | 2 |
| 51 | 0x33 | 3 | 3 | 3 |
| 52 | 0x34 | 4 | 4 | 4 |
| 53 | 0x35 | 5 | 5 | 5 |
| 54 | 0x36 | 6 | 6 | 6 |
| 55 | 0x37 | 7 | 7 | 7 |
| 56 | 0x38 | 8 | 8 | 8 |
| 57 | 0x39 | 9 | Digit Nine | 数字 9 |
| 58 | 0x3A | : | : | : |
| 59 | 0x3B | ; | ; | ; |
| 60 | 0x3C | < | < | < |
| 61 | 0x3D | = | = | = |
| 62 | 0x3E | > | > | > |
| 63 | 0x3F | ? | ? | ? |
| 64 | 0x40 | @ | @ | @ |
| 65 | 0x41 | A | Uppercase A | 大写 A |
| 66 | 0x42 | B | B | B |
| 67 | 0x43 | C | C | C |
| 68 | 0x44 | D | D | D |
| 69 | 0x45 | E | E | E |
| 70 | 0x46 | F | F | F |
| 71 | 0x47 | G | G | G |
| 72 | 0x48 | H | H | H |
| 73 | 0x49 | I | I | I |
| 74 | 0x4A | J | J | J |
| 75 | 0x4B | K | K | K |
| 76 | 0x4C | L | L | L |
| 77 | 0x4D | M | M | M |
| 78 | 0x4E | N | N | N |
| 79 | 0x4F | O | O | O |
| 80 | 0x50 | P | P | P |
| 81 | 0x51 | Q | Q | Q |
| 82 | 0x52 | R | R | R |
| 83 | 0x53 | S | S | S |
| 84 | 0x54 | T | T | T |
| 85 | 0x55 | U | U | U |
| 86 | 0x56 | V | V | V |
| 87 | 0x57 | W | W | W |
| 88 | 0x58 | X | X | X |
| 89 | 0x59 | Y | Y | Y |
| 90 | 0x5A | Z | Uppercase Z | 大写 Z |
| 91 | 0x5B | [ | [ | [ |
| 92 | 0x5C | \ | \ | \ |
| 93 | 0x5D | ] | ] | ] |
| 94 | 0x5E | ^ | ^ | ^ |
| 95 | 0x5F | _ | _ | _ |
| 96 | 0x60 | ` | ` | ` |
| 97 | 0x61 | a | Lowercase a | 小写 a |
| 98 | 0x62 | b | b | b |
| 99 | 0x63 | c | c | c |
| 100 | 0x64 | d | d | d |
| 101 | 0x65 | e | e | e |
| 102 | 0x66 | f | f | f |
| 103 | 0x67 | g | g | g |
| 104 | 0x68 | h | h | h |
| 105 | 0x69 | i | i | i |
| 106 | 0x6A | j | j | j |
| 107 | 0x6B | k | k | k |
| 108 | 0x6C | l | l | l |
| 109 | 0x6D | m | m | m |
| 110 | 0x6E | n | n | n |
| 111 | 0x6F | o | o | o |
| 112 | 0x70 | p | p | p |
| 113 | 0x71 | q | q | q |
| 114 | 0x72 | r | r | r |
| 115 | 0x73 | s | s | s |
| 116 | 0x74 | t | t | t |
| 117 | 0x75 | u | u | u |
| 118 | 0x76 | v | v | v |
| 119 | 0x77 | w | w | w |
| 120 | 0x78 | x | x | x |
| 121 | 0x79 | y | y | y |
| 122 | 0x7A | z | Lowercase z | 小写 z |
| 123 | 0x7B | { | { | { |
| 124 | 0x7C | | | | | | |
| 125 | 0x7D | } | } | } |
| 126 | 0x7E | ~ | ~ | ~ |
| 127 | 0x7F | DEL | Delete | 删除 |
Frequently Asked Questions
What is ASCII?
ASCII (American Standard Code for Information Interchange) uses 7 bits to represent 128 characters including letters, digits, punctuation and control characters — the most basic character encoding.
How is ASCII related to Unicode?
ASCII covers only 128 characters; Unicode is a superset that is compatible with the first 128 ASCII code points and extends to every writing system. UTF-8 is an ASCII-compatible Unicode encoding.
What are control characters?
Code points 0-31 and 127 are control characters (e.g. LF, CR, Tab) that are not printable; they are used for device control and text formatting.
Why represent ASCII in hex?
Hexadecimal is more compact and readable than binary or decimal (0x41 = "A"), and is most common when debugging protocols and parsing messages.
How do I look up the ASCII code of a character?
Find the character in the Char column of the table above; the DEC value on its left is the ASCII code and HEX is the hexadecimal form. For example "A" is 65 (0x41), the space (SP) is 32 (0x20), and line feed (LF) is 10 (0x0A).