Toolstia / Text byte size calculator

text byte size calculator

Check how big a string is in bytes. It shows UTF-8, UTF-16 and UTF-32 sizes, the number of Unicode characters, the number of visible characters and how many characters need one, two, three or four bytes.

UTF-8 is what web pages, files and most APIs use. Limits such as a database column of 255 bytes or an SMS segment count bytes or code units rather than visible characters, which is why emoji and accented letters can overflow them.

How it works

  1. Type or paste your text.
  2. Read the byte counts for each encoding.
  3. Check the character size breakdown if the numbers surprise you.

Bytes are not characters

In UTF-8 an English letter takes one byte, accented letters two, most Asian scripts three, and emoji four. A short message full of emoji can use many more bytes than it has characters.

Three ways to count

Code points are Unicode characters. Graphemes are what you see as one character, so a flag or family emoji counts once. JavaScript length counts UTF-16 units, which is why one emoji can report as 2.

Where it matters

Database columns, API body limits, SMS and push notification sizes and file sizes all count bytes or code units rather than visible characters.

Encodings

UTF-16 uses two bytes per unit and UTF-32 uses four per code point. The UTF-16 figure here has no byte order mark.

Questions

Is a line break counted?

Yes, as one byte in UTF-8 for a newline.

Why does my emoji show 2 for length?

JavaScript counts UTF-16 units, and an emoji needs two of them.

Is my text uploaded?

Everything happens in your browser, and nothing you enter is sent anywhere.