Calculate the UTF-8 encoded byte size of text with mixed character ranges.
UTF-8 is variable width, so byte length and character count differ for any non-ASCII text. Latin accented letters take two bytes, most Asian scripts three, and emoji four. Assuming one byte per character is the most common cause of truncated text and off-by-one buffer errors in internationalised software.
UTF-8 Byte Size
Bytes = ASCII + 2 × two-byte + 3 × three-byte + 4 × four-byte characters
Bytes = ASCII + 2 × two-byte + 3 × three-byte + 4 × four-byte characters UTF-8 is variable width, so byte length and character count differ for any non-ASCII text. Latin accented letters take two bytes, most Asian scripts three, and emoji four.
Assuming one byte per character is the most common cause of truncated text and off-by-one buffer errors in internationalised software.
This calculator takes 4 inputs: ASCII characters, Two-byte characters, Three-byte characters, Four-byte characters such as emoji. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.