UTF-8 Byte Size Calculator
Inputs
| Text | Héllo |
|---|
UTF-8 Byte Size Calculator
Enter any text to find its UTF-8 byte size, UTF-16 byte size, and character (code point) count. ASCII letters take one UTF-8 byte each, accented letters take two, most other scripts take three, and emoji take four — which is why a string’s byte size can be larger than the number of characters you see.
Inputs
Text
Results
Enter a value to see results.
Size
UTF-8 Byte Size
A string of text and the number of bytes it occupies are not the same thing. On screen a word is a run of characters; in storage and on the wire it is a sequence of bytes, and the count of one rarely matches the count of the other. This calculator takes a piece of text and reports three numbers: how many characters (Unicode code points) it contains, how many bytes it takes as UTF-8, and how many bytes it takes as UTF-16. It is useful for sizing database columns, checking against API and message-length limits, and understanding why a short-looking string can be surprisingly large.
Characters versus bytes
A character is a unit of writing — a letter, a digit, an ideograph, an emoji. Unicode assigns each one a number called a code point, written like U+00E9. A byte is a unit of storage, eight bits. An encoding is the rule that turns code points into bytes, and different encodings produce different byte counts for the same text.
For plain English the distinction is easy to miss, because in the common encodings each ASCII character happens to be a tidy number of bytes. The gap appears as soon as the text contains accents, non-Latin scripts, or emoji.
How UTF-8 sizes a character
UTF-8 is a variable-width encoding: a character takes between one and four bytes depending on its code point.
U+0000–U+007F(ASCII: unaccented Latin letters, digits, common punctuation): 1 byteU+0080–U+07FF(Latin accents, Greek, Cyrillic, Hebrew, Arabic): 2 bytesU+0800–U+FFFF(most CJK and other scripts): 3 bytesU+10000and above (emoji and rare characters): 4 bytes
Because ASCII characters stay one byte, UTF-8 is backward-compatible with ASCII, which is a large part of why it became the default encoding of the web and of text files.
How UTF-16 sizes a character
UTF-16 stores most characters in a single 16-bit code unit, which is two bytes. Characters above U+FFFF — emoji and other rare symbols — are stored as a surrogate pair of two code units, so they take four bytes. There is no one-byte case: even a plain ASCII letter costs two bytes in UTF-16. This is the in-memory string format of languages such as Java, C#, and JavaScript.
Worked example
Take the text Héllo.
There are 5 characters but 6 UTF-8 bytes, because é falls in the two-byte range. In UTF-16 every one of the 5 characters is a single two-byte code unit, giving 10 bytes.
Now take a single emoji, 😀 (U+1F600). It is one character, but it lies above U+FFFF. UTF-8 encodes it as four bytes, and UTF-16 stores it as a surrogate pair, also four bytes — yet the character count is just 1.
Why the byte size matters
Limits in real systems are usually counted in bytes, not characters. A VARCHAR(255) column may cap bytes or characters depending on the database and its charset; message-length restrictions, API payload fields, HTTP header sizes, and form validators are frequently expressed in bytes. Measuring the UTF-8 byte size in advance tells you whether a value will fit and how much space or bandwidth it will consume, which a character count alone cannot.
Related calculators
To see the actual byte values of a string as binary, hexadecimal, and decimal codes, use the Text to Binary / Hex / ASCII Converter. To measure the size of text once it is wrapped in Base64 for transport, see the Base64 Encoding Overhead Calculator. And to estimate how much information a string carries rather than how much space it takes, the Shannon Entropy Calculator computes its entropy.
Frequently Asked Questions (FAQ)
Why is the byte size larger than the character count?
A character is what you see; a byte is how it is stored. In UTF-8, only the basic ASCII characters (unaccented Latin letters, digits, common punctuation) fit in a single byte. Accented letters such as é use two bytes, most other scripts use three, and emoji use four. So any text containing non-ASCII characters takes more bytes than it has characters.
In UTF-16 the gap is even wider for ASCII text, because every character there uses at least two bytes.
What is the difference between UTF-8 and UTF-16?
Both are ways of turning Unicode characters into bytes. UTF-8 uses a variable width of one to four bytes per character and is backward-compatible with ASCII, which makes it the dominant encoding on the web and in files. UTF-16 uses two bytes for most characters and four for the rare ones beyond the Basic Multilingual Plane (such as emoji); it is common in the in-memory string representation of languages like Java, C#, and JavaScript.
For English-heavy text UTF-8 is smaller; for text dominated by East Asian scripts the two are often comparable.
How many bytes does one character take?
In UTF-8 it depends on the code point: U+0000–U+007F (ASCII) is one byte, U+0080–U+07FF (Latin accents, Greek, Cyrillic, Hebrew, Arabic) is two bytes, U+0800–U+FFFF (most CJK and other scripts) is three bytes, and U+10000 and above (emoji, rare characters) is four bytes.
In UTF-16 the same characters take two bytes up to U+FFFF and four bytes above it, where they are stored as a surrogate pair.
When does the byte size matter?
Storage and transmission are measured in bytes, not characters. A database column declared as VARCHAR(255) may limit either bytes or characters depending on the engine and charset; API fields, message-length caps, and form limits are frequently expressed in bytes. Knowing the UTF-8 byte size helps you predict whether a value will fit and how much space or bandwidth it will use.
Recommended Next
Text to Binary / Hex / ASCII Converter
Enter any text to see it as binary, hexadecimal, and decimal character codes. Binary and hex follow the UTF-8 byte sequence, while decimal lists each character’s Unicode code point — the familiar ASCII value for plain English text.