Dev & Computing · UTF-8 编码 · Updated 2026-10-25
What Is UTF-8 Encoding?
Definition
UTF-8 is the dominant encoding of Unicode: ASCII characters take 1 byte (fully compatible with legacy encodings), most European letters 2, CJK characters 3, and emoji plus rare scripts 4. The variable-length design keeps English text unchanged and inflates CJK by ~50% in exchange for one universal code that never conflicts. "A Chinese character is 2 bytes" is a GBK-era memory — under UTF-8 it is 3.
Formula
Size estimation: Latin ≈ character count; CJK ≈ characters × 3 (UTF-8) or × 2 (GBK)
Worked Example
The three CJK characters in "一键算" take 9 bytes (3×3) in UTF-8; "abc一键算" is 3+9=12 bytes but has JavaScript .length 6 — bytes and characters are two different measures.
Common Misconception
Blaming UTF-8 for "garbled text" — mojibake is nearly always a declaration mismatch (a UTF-8 file decoded as GBK). Also, MySQL's "utf8" charset is a broken 3-byte max implementation that cannot store emoji; the correct choice is utf8mb4.
Matching Calculators
Related Terms
Keep Exploring
Browse the full glossary, or head back to the homepage for 1,435 free online calculators.
Back to glossary