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.

DECHEXCharNameChinese Name
00x00NULNull空字符
10x01SOHStart of Heading标题开始
20x02STXStart of Text正文开始
30x03ETXEnd of Text正文结束
40x04EOTEnd of Transmission传输结束
50x05ENQEnquiry询问
60x06ACKAcknowledge确认
70x07BELBell响铃
80x08BSBackspace退格
90x09HTHorizontal Tab水平制表
100x0ALFLine Feed换行
110x0BVTVertical Tab垂直制表
120x0CFFForm Feed换页
130x0DCRCarriage Return回车
140x0ESOShift Out移出
150x0FSIShift In移入
160x10DLEData Link Escape数据链路转义
170x11DC1Device Control 1设备控制1
180x12DC2Device Control 2设备控制2
190x13DC3Device Control 3设备控制3
200x14DC4Device Control 4设备控制4
210x15NAKNegative Acknowledge否定确认
220x16SYNSynchronous Idle同步空闲
230x17ETBEnd of Trans. Block传输块结束
240x18CANCancel取消
250x19EMEnd of Medium介质结束
260x1ASUBSubstitute替换
270x1BESCEscape转义
280x1CFSFile Separator文件分隔符
290x1DGSGroup Separator组分隔符
300x1ERSRecord Separator记录分隔符
310x1FUSUnit Separator单元分隔符
320x20SPSpace空格
330x21!Exclamation Mark感叹号
340x22"Quotation Mark双引号
350x23#Number Sign井号
360x24$Dollar Sign美元符号
370x25%Percent Sign百分号
380x26&Ampersand与号
390x27'Apostrophe单引号
400x28(Left Parenthesis左括号
410x29)Right Parenthesis右括号
420x2A*Asterisk星号
430x2B+Plus Sign加号
440x2C,Comma逗号
450x2D-Hyphen连字符
460x2E.Period句点
470x2F/Slash斜杠
480x300Digit Zero数字 0
490x31111
500x32222
510x33333
520x34444
530x35555
540x36666
550x37777
560x38888
570x399Digit Nine数字 9
580x3A:::
590x3B;;;
600x3C<<<
610x3D===
620x3E>>>
630x3F???
640x40@@@
650x41AUppercase A大写 A
660x42BBB
670x43CCC
680x44DDD
690x45EEE
700x46FFF
710x47GGG
720x48HHH
730x49III
740x4AJJJ
750x4BKKK
760x4CLLL
770x4DMMM
780x4ENNN
790x4FOOO
800x50PPP
810x51QQQ
820x52RRR
830x53SSS
840x54TTT
850x55UUU
860x56VVV
870x57WWW
880x58XXX
890x59YYY
900x5AZUppercase Z大写 Z
910x5B[[[
920x5C\\\
930x5D]]]
940x5E^^^
950x5F___
960x60```
970x61aLowercase a小写 a
980x62bbb
990x63ccc
1000x64ddd
1010x65eee
1020x66fff
1030x67ggg
1040x68hhh
1050x69iii
1060x6Ajjj
1070x6Bkkk
1080x6Clll
1090x6Dmmm
1100x6Ennn
1110x6Fooo
1120x70ppp
1130x71qqq
1140x72rrr
1150x73sss
1160x74ttt
1170x75uuu
1180x76vvv
1190x77www
1200x78xxx
1210x79yyy
1220x7AzLowercase z小写 z
1230x7B{{{
1240x7C|||
1250x7D}}}
1260x7E~~~
1270x7FDELDelete删除

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).