← All text tools

Text Byte Counter and Encoding Viewer

Count how many bytes a text takes in UTF-8, UTF-16 and UTF-32 with characters, code points and code units, see a per-character byte table and encode or decode UTF-16 hex.

  • Free
  • No sign-up
  • Works on any device

About Text Byte Counter and Encoding Viewer

How long a text is depends on what you count. This tool measures the same text four ways: bytes in UTF-8, UTF-16 and UTF-32, user-perceived characters, Unicode code points and UTF-16 code units. A table shows the code point, UTF-8 bytes, UTF-16 bytes and UTF-32 value of every character, so you can see that é takes two UTF-8 bytes and 😀 takes four in UTF-8 and four in UTF-16 as a surrogate pair. It also encodes text to UTF-16 hex and decodes UTF-16 hex back to text.

How to use Text Byte Counter and Encoding Viewer

  1. Paste or type the text to measure; the sample mixes Latin, Chinese and an emoji.
  2. Read the sizes in each encoding and the per-character table.
  3. Switch to the UTF-16 encoder or decoder to convert between text and hex bytes.

Why use this tool?

Also known as

Frequently asked questions

Why is the byte count bigger than the character count?

In UTF-8, only ASCII letters take one byte. Accented letters take two, most Asian characters three and emoji four, so a short text in another language can use many more bytes than characters.

What is a surrogate pair in UTF-16?

Characters above U+FFFF, like most emoji, do not fit in one 16-bit unit, so UTF-16 stores them as two units called a surrogate pair. That is why JavaScript reports a length of 2 for 😀.

Does the size include a byte order mark?

No. Sizes count only the text. The UTF-16 encoder can add the mark FE FF or FF FE if you tick the option, which makes the result two bytes longer.

Is Text Byte Counter and Encoding Viewer free?

Yes. Text Byte Counter and Encoding Viewer on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

Can I put Text Byte Counter and Encoding Viewer on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.