UTF-8 Size Calculator
Byte count of any text in UTF-8, with per character width.
What it does
UTF-8 stretches per character: plain ASCII rides 1 byte each while accented Latin takes 2, CJK takes 3, and emoji take 4. Hello with two CJK characters totals 13 bytes across 9 characters with a 3 byte max.
The tool above takes any text and returns byte count with character count and widest width beside it. Surrogate halves and empties reject loudly instead of guessing.
Byte bands follow RFC 3629 with Unicode FAQ beside it: U+0000 to U+007F in one octet, U+0080 to U+07FF in two, U+0800 to U+FFFF in three, the rest in four. ASCII text is valid UTF-8 unchanged, and overlongs with surrogates stay illegal.
Counts drive storage, limits, and SMS style budgets. Databases size in bytes while users count characters, so both numbers ship together.
How to use
- Paste or type the text.
- Read bytes first, characters beside it.
- Read widest for the costliest character.
- Test emoji separately; they take 4.
- Keep inputs under 10000 characters.
- Size storage in bytes, UI in characters.
Formula
- code point
- Unicode scalar value per character.
- surrogates
- U+D800 to U+DFFF halves, never standalone.
- overlongs
- Non minimal byte forms, always illegal.
BOM EF BB BF is a signature, not content. CESU pairs of 3 byte surrogates are not valid UTF-8.
Worked example
Example: Hello, 世界
Default text with 7 ASCII plus 2 CJK.
- ASCII: 7 chars x 1 = 7 bytes.
- CJK: 2 chars x 3 = 6 bytes.
- Total: 7 + 6 = 13 bytes.
- Count: 9 characters.
- Widest: 3 bytes (CJK).
- Tool shows 13 bytes, 9 characters, 3 bytes max.
Reference table
| Range | Bytes | Example |
|---|---|---|
| U+0000 to U+007F | 1 | ABC is 3 bytes |
| U+0080 to U+07FF | 2 | é is C3 A9 |
| U+0800 to U+FFFF | 3 | 世 is E4 B8 96 |
| U+10000 up | 4 | Emoji is F0 9F 98 80 |
| BOM signature | EF BB BF | Not content |
Limits
- Counts bytes, not glyphs or graphemes.
- Combining marks count separately.
- 10000 character cap per run.
- Unpaired surrogates rejected.
Common mistakes
- Sizing storage in characters.
- Assuming 1 char is 1 byte.
- Counting BOM as content.
- Accepting overlong sequences.
- Splitting surrogate pairs.
Try it yourself
Quick checks. Answers sit tucked under each question.
ABC?
3 bytes, 3 characters, 1 byte max.
é (U+00E9)?
2 bytes, 1 character.
Emoji U+1F600?
4 bytes, 1 character.
Questions
Default size?
13 bytes across 9 characters.
CJK width?
3 bytes each.
Emoji width?
4 bytes each.
Endianness?
None: UTF-8 is byte ordered.
ASCII compatible?
Yes: plain ASCII is valid UTF-8 unchanged.
Base64 page versus this?
That re-encodes bytes; this measures them.