What UTF-8 is
This article takes about 4 minutes to read.
Web pages, APIs, email headers, databases. UTF-8 is the de facto standard for modern character encoding.It is a mechanism that represents Unicode codepoints with a variable length of 1 to 4 bytes, and while keeping backward compatibility with ASCII, it can handle all Unicode characters, including emoji. In places you do not usually think about, it works as the foundation for the circulation of digital text.
Definition
UTF-8 (8-bit Unicode Transformation Format) is one of the encoding schemes that convert Unicode codepoints into byte sequences. Ken Thompson and Rob Pike designed it in 1992, and it was later standardized as RFC 3629. It represents the entire Unicode range (U+0000 to U+10FFFF) with a variable length of 1 to 4 bytes per character.
Byte structure
| Codepoint range | Bytes | Examples |
|---|---|---|
| U+0000 - U+007F | 1 byte | ASCII (a, A, 0, !) |
| U+0080 - U+07FF | 2 bytes | Latin extensions, Greek, Cyrillic |
| U+0800 - U+FFFF | 3 bytes | Japanese, Chinese, Korean |
| U+10000 - U+10FFFF | 4 bytes | Emoji, ancient scripts, supplementary kanji |
Compatibility with ASCII
An important design feature of UTF-8 is that it represents ASCII (U+0000 - U+007F) as is, in 1 byte. A file written only with letters, digits, and half-width symbols is interpreted as the same byte sequence whether it is read as ASCII or as UTF-8. This backward compatibility, which lets existing ASCII text processing tools handle UTF-8 files without breaking them, helped it spread on the Web.
Comparison with UTF-16 / UTF-32
| Scheme | 1 character | Main uses | Handling of emoji |
|---|---|---|---|
| UTF-8 | 1 to 4 bytes | Web, APIs, files | Represented in 4 bytes |
| UTF-16 | 2 or 4 bytes | Internal representation in Java and JS | 4 bytes as a surrogate pair |
| UTF-32 | Fixed 4 bytes | Internal processing (rare) | Fixed 4 bytes |
Its position as the Web standard
The HTML specification recommends UTF-8 as the character encoding, and many pages served on the Web use UTF-8 (as of August 2026). From HTTP headers, JSON, XML, email bodies, and file names to percent-encoding in URLs, UTF-8 is assumed everywhere on the Web. There is almost no reason to choose anything other than UTF-8 for new development.
BOM (Byte Order Mark)
There is a practice of adding a 3-byte BOM, EF BB BF, at the start of a UTF-8 file, but the UTF-8 BOM is not recommended in Web standards. UTF-8 with a BOM is produced by older Windows tools (such as Notepad), but Linux / Mac tools and web servers may treat it as unexpected bytes, which can cause problems. Saving new files without a BOM is the modern practice.
Points to watch in practice
- Confusing character count with byte count: One Japanese character is 3 bytes in UTF-8, and an emoji is 4 bytes. If you judge length by byte count, multibyte characters become a source of confusion
- Database character sets: MySQL's
utf8is actually an incomplete implementation that can only handle up to 3 bytes. If you handle emoji, chooseutf8mb4 - URL encoding: When you include Japanese text or emoji in a URL, the UTF-8 byte sequence is encoded with percent-encoding
- Reading files: If you mistakenly open a file as Shift_JIS, the text gets garbled (old CSV files and so on)
Common misconceptions
- ❌ "UTF-8 is fixed at 8 bits" → ✅ It is variable-length, with 8 bits as the smallest unit
- ❌ "UTF-8 is slower than UTF-16" → ✅ It depends on the content and processing. With heavy use of Japanese, there are cases where UTF-16 is shorter
- ❌ "A BOM is required" → ✅ In UTF-8, no BOM is the standard practice
Related terms
- Unicode - the character standard that UTF-8 represents
- Surrogate pair - a mechanism specific to UTF-16
- Emoji - represented in 4 bytes in UTF-8
Was this article helpful?