Core answer: ASCII encodes 128 English characters in 7 bits; Unicode gives every character on earth a unique code point (中 = U+4E2D); UTF-8 is Unicode's storage format using 1-4 variable bytes — 1 byte for English, 3 for Chinese, 4 for emoji. Unicode defines the number, UTF-8 defines the bytes, ASCII is the shared subset.
How the three standards relate
| Standard | Solves | Capacity | Unit |
|---|---|---|---|
| ASCII (1963) | Digitizing English | 128 chars | 7 bits |
| Unicode (1991) | One number per character | 1,114,112 code points | Code point (not bytes) |
| UTF-8 (1993) | Byte storage of Unicode | Same as Unicode | 1-4 variable bytes |
Key distinction: code point ≠ bytes. The code point is a logical number (中 is always U+4E2D); bytes are physical storage (E4 B8 AD in UTF-8, D6 D0 in GBK).
Common code points table
| Char | Code point | UTF-8 bytes |
|---|---|---|
| A | U+0041 (65) | 1: 41 |
| a | U+0061 (97) | 1: 61 |
| 0 | U+0030 (48) | 1: 30 |
| space | U+0020 (32) | 1: 20 |
| 中 | U+4E2D | 3: E4 B8 AD |
| © | U+00A9 | 2: C2 A9 |
| 😀 | U+1F600 | 4: F0 9F 98 80 |
Counting UTF-8 bytes
- U+0000–U+007F → 1 byte (identical to ASCII)
- U+0080–U+07FF → 2 bytes (Latin extended, Greek, Cyrillic)
- U+0800–U+FFFF → 3 bytes (most CJK characters live here)
- U+10000–U+10FFFF → 4 bytes (emoji, rare ideographs)
Rule of thumb: UTF-8 bytes of pure Chinese text ≈ characters × 3.
Example: three layers of 中
- Character: 中
- Code point: U+4E2D (decimal 20013) — the permanent Unicode number
- UTF-8 bytes:
E4 B8 AD— U+4E2D falls in the 3-byte range; the 16-bit code point fills the1110xxxx 10xxxxxx 10xxxxxxtemplate
The [Unicode lookup tool](/c/dev/unicode) shows code points plus UTF-8/UTF-16 byte breakdowns for any character.
Example: why emoji length is 2
In JavaScript, an emoji reports length 2 because strings count UTF-16 code units; U+1F600 sits outside the Basic Multilingual Plane and needs a surrogate pair. Iterate with [...str] or for...of (code-point aware) or emoji get sliced into broken halves.
Common mistakes
- "Unicode is UTF-8": Unicode is the numbering table; UTF-8/UTF-16/UTF-32 are storage formats.
- "Chinese is always 2 bytes": that is GBK. UTF-8 Chinese is 3 bytes — and legacy MySQL utf8 (3-byte max) cannot store emoji, which is exactly why utf8mb4 exists.
- "Mojibake means corrupted data": 99% of cases are a declaration mismatch; fix the reading encoding and the data is intact.
- "Morse is an encoding": Morse is a timing of signals (dots and dashes), not byte storage — SOS = ···−−−··· belongs to a pre-digital era.