Text Byte Size Calculator
Paste a text and see how many bytes it takes in UTF-8, UTF-16 and UTF-32, along with the number of characters, the UTF-16 length that JavaScript reports and the size in ISO-8859-1. A breakdown shows how many characters take 1, 2, 3 and 4 bytes in UTF-8. Enter a limit in bytes to see how much room is left, or how much is over, and trim the text to fit without cutting a character in half. Everything runs in your browser.
A computer stores text as bytes, and how many depends on the encoding. UTF-8 uses 1 byte for the characters U+0000 to U+007F, which are the same as ASCII, 2 bytes up to U+07FF, 3 bytes up to U+FFFF and 4 bytes above that, so an accented letter takes 2, a euro sign takes 3 and an emoji takes 4. UTF-16 uses 2 bytes for most characters and 4 for those above U+FFFF, which JavaScript counts as 2 in its length. UTF-32 uses 4 bytes for every character. A byte order mark, if the file has one, adds 3 bytes in UTF-8, 2 in UTF-16 and 4 in UTF-32. Limits such as a database column, an SMS part or an API field are often in bytes and not in characters, so a text of 100 characters can be 100 to 400 bytes. The trim button cuts after the last whole character that fits, never in the middle of one. It counts code points, so a letter with a separate accent, or an emoji made of several parts, counts as more than one character. Everything runs in your browser.
Related Tools
[6 suggestions]Character Counter
Count characters with and without spaces, plus code points, UTF-16 units and UTF-8 bytes.
Analysis & CountingSMS Character Counter: Segments, GSM 7-bit and Unicode
Count the characters and the number of segments in a text message, see whether it uses GSM 7-bit or Unicode, and fix the characters that make it longer.
Analysis & CountingUnicode Character Inspector
See every code point in your text with its U+ number, category, script, UTF-8 bytes and UTF-16 units, and spot hidden characters.
Developer & WebText to Binary Translator
Convert text to binary, hex, decimal, or octal and decode it back, using UTF-8 bytes.
Developer & WebText to Hex Converter
Convert text to hexadecimal bytes and hex back to text, in UTF-8, UTF-16 or Latin-1, with your choice of separator and prefix.
Format ConversionCharacter Limit Checker
Check text against character limits for meta titles, meta descriptions, X, Instagram, LinkedIn, YouTube, Google Ads, and SMS.
Analysis & CountingAbout the Text Byte Size Calculator
A computer stores text as bytes, and how many depends on the encoding. UTF-8, the usual encoding of files and the web, uses 1 byte for the characters U+0000 to U+007F, which are the same as ASCII, 2 bytes up to U+07FF, 3 bytes up to U+FFFF and 4 bytes above that, so an accented letter such as e with an acute accent takes 2 bytes, the euro sign takes 3 and an emoji takes 4. UTF-16 uses 2 bytes for most characters and 4 for those above U+FFFF, which is why JavaScript reports the length of an emoji as 2, and UTF-32 uses 4 bytes for every character. ISO-8859-1, also called Latin-1, uses one byte a character but only covers U+0000 to U+00FF, so the tool says when a text does not fit. If a file starts with a byte order mark, it adds 3 bytes in UTF-8, 2 in UTF-16 and 4 in UTF-32, and a checkbox counts it. Limits such as a database column, an SMS part, an HTTP header or an API field are often in bytes and not in characters, so a text of 100 characters can be 100 to 400 bytes, and the tool shows both so you can see which limit you are close to. When you enter a limit, it tells you how many bytes are left or how many are over, and a button trims the text to the longest start that fits, always after a whole character. A lone surrogate, which is not a valid character, is counted as the 3 byte replacement character that encoders write. It counts code points, so a letter with a separate combining accent, or an emoji built from several parts such as a family, counts as more than one character.
How many bytes is my text in UTF-8?▾
Paste it in. Each character takes 1 byte if it is ASCII, 2 bytes for most Latin accents, Greek and Cyrillic, 3 for most other scripts and the euro sign, and 4 for emoji. The tool adds them up for you.
Why is the byte count bigger than the character count?▾
Because only the first 128 characters take one byte in UTF-8. Accented letters take 2, many symbols and scripts take 3, and emoji take 4, so a short text of such characters can have several times as many bytes as characters.
How do I fit a text into a byte limit?▾
Enter the limit in bytes. The tool shows how many bytes are left or over, and the Trim button cuts the text after the last whole character that fits, so it never leaves half a character.
What is the difference between UTF-8, UTF-16 and UTF-32?▾
UTF-8 uses 1 to 4 bytes a character and is the same as ASCII for the first 128. UTF-16 uses 2 or 4 bytes. UTF-32 always uses 4. All three can represent every Unicode character.
Does a byte order mark count?▾
Only if the file has one. A UTF-8 byte order mark adds 3 bytes, UTF-16 adds 2 and UTF-32 adds 4. It is optional in UTF-8, so tick the box only when your file starts with it.