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

StandardSolvesCapacityUnit
ASCII (1963)Digitizing English128 chars7 bits
Unicode (1991)One number per character1,114,112 code pointsCode point (not bytes)
UTF-8 (1993)Byte storage of UnicodeSame as Unicode1-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

CharCode pointUTF-8 bytes
AU+0041 (65)1: 41
aU+0061 (97)1: 61
0U+0030 (48)1: 30
spaceU+0020 (32)1: 20
U+4E2D3: E4 B8 AD
©U+00A92: C2 A9
😀U+1F6004: 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 中

  1. Character: 中
  2. Code point: U+4E2D (decimal 20013) — the permanent Unicode number
  3. UTF-8 bytes: E4 B8 AD — U+4E2D falls in the 3-byte range; the 16-bit code point fills the 1110xxxx 10xxxxxx 10xxxxxx template

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.