UTF-8 Byte Counter
Count how many bytes a string takes in UTF-8 and compare against UTF-16, UTF-32, and ASCII. See per-plane breakdowns, surrogate flags, and where database VARCHAR limits, tweet caps, and API tokens really land.
UTF-8 Byte Length Reference
| Character | Unicode code point | UTF-8 bytes |
|---|---|---|
| A | U+0041 | 1 |
| é | U+00E9 | 2 |
| € | U+20AC | 3 |
| Grinning face | U+1F600 | 4 |
Frequently Asked Questions about the UTF-8 Byte Counter
Why is UTF-8 variable length and how many bytes does each character take?
UTF-8 was designed by Ken Thompson and Rob Pike in 1992 to encode every Unicode code point in 1 to 4 bytes, picking the shortest length that fits. Code points U+0000 to U+007F (ASCII) take 1 byte, U+0080 to U+07FF (most Latin scripts plus Greek, Cyrillic, Hebrew, Arabic) take 2 bytes, U+0800 to U+FFFF (most CJK, plus most other living scripts) take 3 bytes, and anything from U+10000 upward (emoji, historic scripts, rare CJK) takes 4 bytes. The variable length is what makes UTF-8 compact for English-heavy text while still covering every character in the Unicode standard.
Why is ASCII a subset of UTF-8?
UTF-8 encodes every code point from U+0000 to U+007F as a single byte with the exact same numeric value as ASCII. The byte 0x41 means "A" in pure ASCII and in UTF-8, so any file that contains only ASCII characters is already valid UTF-8 with no conversion needed. This is the design property that let UTF-8 spread so fast: existing English-only systems kept working, and the upgrade path for adding accented letters, emoji, or CJK was to just start emitting multi-byte sequences alongside the existing ASCII.
Why does an emoji take 4 bytes in UTF-8?
Most emoji live in the supplementary planes above U+FFFF, for example the grinning face is U+1F600 and the rocket is U+1F680. Anything above U+FFFF needs 4 UTF-8 bytes by the encoding rules, because the leading byte has to flag a 4-byte sequence and the remaining 21 bits of the code point are split across the continuation bytes. Skin tone modifiers, ZWJ-joined family emoji, and country-flag pairs are each their own code point too, so a single visual emoji like a family of four can easily run 16 to 28 bytes. The counter reports per-code-point bytes, not per-grapheme bytes.
Why does JavaScript's string.length differ from the character count?
JavaScript string.length counts UTF-16 code units. The string iterator and Array.from count Unicode code points, so a supplementary code point changes from two units to one item. Neither method counts user-perceived grapheme clusters: a visible symbol can contain several code points.
Where do these byte counts actually matter?
Byte counts matter for HTTP Content-Length, file and object size, transport limits, and database types with byte-based caps. PostgreSQL varchar limits count characters, not UTF-8 bytes, while other databases and indexes use different rules. API rate limits and model context limits may count requests, tokens, or other units instead, so check the target system's definition.
Related Calculators
More calculators in "Tech"
Bits to Bytes ConverterBinary to Decimal ConverterBinary to Text ConverterIP Subnet CalculatorDecimal to Binary ConverterSSN Validator (Format Check)
See all 98 calculators in "Tech"