On this page
UTF-8 is the standard encoding that turns every Unicode character into bytes: plain English letters take 1 byte (byte-for-byte identical to ASCII), most European letters take 2, Chinese characters take 3, and emoji take 4. It is the default encoding of the web — and of this site’s binary code translator. For the head-to-head with its predecessor, see UTF-8 vs ASCII compared. Below: how the variable-length scheme works, where it wins, what it costs, and how to watch it happen live.
The Problem: One Byte Is Not Enough
ASCII covered English with values 0–127, one byte per character. But one byte only holds 256 values, and the world has far more characters than that — Chinese alone has tens of thousands. Unicode assigns every character a unique code point (H is U+0048, 你 is U+4F60, 👋 is U+1F44B), and UTF-8 is the clever scheme that stores those code points in bytes.
How UTF-8 Works
UTF-8 is a variable-length encoding: small code points take few bytes, large ones take more. The first bits of each byte announce the pattern — a byte starting with 0 is a complete one-byte character, 110 starts a two-byte sequence, 1110 starts three, 11110 starts four — and every continuation byte starts with 10, so a decoder can never confuse a continuation for a start.
- 1 byte — code points 0–127: plain English, identical to ASCII. H =
01001000. - 2 bytes — most European and Middle Eastern letters.
- 3 bytes — Chinese, Japanese and Korean characters. 你 =
11100100 10111101 10100000. - 4 bytes — emoji and rare symbols. 👋 =
11110000 10011111 10010001 10001011(hex F0 9F 91 8B).
The Pros: Why UTF-8 Won
- ASCII compatibility — plain English text is byte-for-byte identical to ASCII, so decades of old systems and files kept working without conversion.
- Self-synchronizing — the leading-bit pattern means a decoder that lands mid-string can skip forward to the next start byte without corrupting the rest of the text.
- Universal coverage — every Unicode code point encodes, from ASCII to 你 to the newest emoji, in one scheme.
The Trade-offs
Variable length has a price. You cannot jump straight to the 100th character of a UTF-8 string without scanning from the start, because characters occupy different numbers of bytes. Chinese and Japanese text costs 3 bytes per character where UTF-16 would use 2, and emoji always cost 4. Decoders must also validate input — a lone continuation byte or a truncated sequence is an error, not a character.
Common Mistakes When Working with UTF-8
- Mistake: assuming one character is one byte. “你好” is 2 characters but 6 bytes. Correction: when a size or count looks wrong, count bytes — the translator’s status line always shows the exact byte count.
- Mistake: blaming the file when you see �. Correction: the bytes are usually fine — they were decoded with the wrong encoding. Re-decode as UTF-8 before rewriting anything.
- Mistake: reaching for UTF-16 because two bytes per character sounds simpler. Correction: UTF-16 mostly lives inside Windows, Java and JavaScript internals; everything pasted from chats and websites is almost always UTF-8.
Who Needs to Care (and Who Doesn’t)
If you ever decode binary messages, debug mojibake, or work with text files from different systems, UTF-8 is worth understanding — it explains both why “Hi” is 2 bytes and why 👋 is 4. If you only ever convert short English messages, you can treat it as the invisible default and never think about it again.
Step-by-Step: Watch an Emoji Become Bytes
- Open the binary code translator and type 👋 into the input.
- The tool detects text and converts with UTF-8:
11110000 10011111 10010001 10001011— four bytes. - Open Explain This Result to see the character mapped to code point U+1F44B with hex F0 9F 91 8B.
- Now type a plain English word and compare: one byte per letter, exactly like ASCII.
How to Verify a UTF-8 Conversion Yourself
- Convert “Hi” — expect exactly 2 bytes:
01001000 01101001. - Convert one Chinese character (你) — expect 3 bytes, the first starting with
1110. - Convert one emoji (👋) — expect 4 bytes, the first starting with
11110. - Check that every continuation byte starts with
10— that is the self-synchronizing pattern doing its job.
One honest limit: this flow verifies the encoding — the mapping from characters to bytes. It cannot tell you whether the source text itself was correct; encoding checks the mapping, not the meaning.
See it happen live
Type any text into our binary code translator and open Explain This Result — every character listed with its code point, UTF-8 bytes, hex and binary.
Open the binary code translatorUTF-8 vs UTF-16
UTF-16 uses at least 2 bytes per character and shows up inside Windows, Java and JavaScript. For everything pasted from chats or websites, UTF-8 is almost always the right choice — which is why it is the default here and UTF-16 lives in Advanced settings.
Practice
1. How many bytes does “你好” take in UTF-8? Each Chinese character takes 3 bytes: 2 × 3 = 6 bytes (11100100 10111101 10100000 11100101 10100101 10111101).
2. Is a plain ASCII text file already valid UTF-8? Yes — ASCII bytes 0–127 are identical in UTF-8, so every pure-ASCII file is a valid UTF-8 file with zero conversion.
Frequently Asked Questions
Is UTF-8 the same thing as Unicode?
No. Unicode is the character set — the giant table assigning a code point to every character. UTF-8 is one encoding of that table: the rule for turning code points into bytes. UTF-16 and UTF-32 are other encodings of the same table.
Why do I sometimes see � or strange characters?
That is mojibake: UTF-8 bytes decoded as if they were a single-byte encoding like Latin-1, or a truncated multi-byte sequence replaced by the replacement character. The bytes are usually fine — the decoding was wrong.
Does UTF-8 really cover every language?
Yes. Unicode assigns code points to over 150,000 characters across more than 160 writing systems, and UTF-8 can encode every one of them — including characters added in future Unicode versions.
How many bytes does an emoji take in UTF-8?
Four. Emoji live above code point U+FFFF, and UTF-8 encodes values that large as 4 bytes — 👋, for example, is the bytes F0 9F 91 8B.
Is UTF-8 backward compatible with ASCII?
Yes, exactly. Every pure-ASCII file is already a valid UTF-8 file: bytes 0–127 are identical in both, so nothing needs converting.
What does the 8 in UTF-8 stand for?
8-bit code units — UTF-8 builds every character from 8-bit bytes. Its siblings use larger units: UTF-16 works in 16-bit chunks and UTF-32 in 32-bit chunks.
What is a code point?
A character’s ID number in the Unicode table, written in the style U+0048 — H is U+0048, 你 is U+4F60. An encoding like UTF-8 is the rule that turns code points into bytes.
Can UTF-8 fail to decode?
Yes — a truncated or corrupted byte sequence is rejected, and that strictness is deliberate: a decoder that guessed would show wrong characters silently. A good tool reports the exact byte that broke instead of hiding it.