One Emoji Is One Character, Two Units, Four Bytes and Twelve
Published 11/26/2026 · 3 min read · Developer tools
Daniel Okonkwo — Front-end developer and tech writer at OneKitly
Web performance · File formats
Checked against 2 sources
A grinning face is a single code point, U+1F600. JavaScript's string length reports 2, because it counts UTF-16 units and anything above U+FFFF takes a surrogate pair. Stored as UTF-8 it occupies 4 bytes. Percent-encoded for a URL it becomes %F0%9F%98%80, twelve characters. Every one of those numbers is correct for its layer, and a limit written as "20 characters" without saying which layer is a defect that will surface the first time someone types é — one character, two bytes, six percent-encoded characters.
Depending on which layer is counting, 😀 has length 1, 2, 4 or 12. A field limit that does not say which one is a bug waiting for a French accent.
Percent-encoding works on bytes, not on characters
That is why é becomes two triplets rather than one: the character is first turned into its UTF-8 bytes, C3 and A9, and each byte is then written as a percent sign and two hex digits. A system that encodes the same character from a Latin-1 byte produces %E9 instead, which is a different URL pointing at a different thing, and the mismatch is invisible until someone compares two links that look identical on screen. Normalising to UTF-8 before encoding is the whole fix.
Some things that look like one character are five
A family emoji is built by joining three separate people with zero-width joiners: five code points, eight UTF-16 units, eighteen UTF-8 bytes and fifty-four percent-encoded characters, all rendered as one picture. Truncating such a string by counting units splits the sequence and leaves half a family on screen. Anything that slices user text — a preview, a summary, a database column — has to cut on grapheme boundaries rather than on any of the four counts above.
| Character | UTF-16 units / UTF-8 bytes | Percent-encoded |
|---|---|---|
| a | 1 / 1 | a — 1 character |
| é | 1 / 2 | %C3%A9 — 6 |
| — (em dash) | 1 / 3 | %E2%80%94 — 9 |
| 😀 | 2 / 4 | %F0%9F%98%80 — 12 |
Frequently asked questions
- Which count should a form field limit use?
- Whatever the storage enforces, and it should be stated in the interface. A column declared as 100 bytes will reject a 60-character French sentence that a user counted as fitting; a column declared as 100 characters will accept it and may still break a downstream system that counts bytes. The safest arrangement is to size the storage generously, validate in the unit the user sees, and never let the two disagree silently.
- Why does UTF-8 use a different number of bytes per character?
- Because it was designed so that plain ASCII text stays byte-for-byte identical, which let it be adopted without rewriting the world. Characters up to U+007F take one byte, up to U+07FF two, up to U+FFFF three and the rest four. The cost is that byte length no longer tells you character count, and the benefit is that a file of English text is the same size it always was — a trade that has held for thirty years.
Articles you may find interesting
All guides →Related tools
Sources
Spotted a mistake in this article?