Canonical: https://toolipedia.app/text-byte-counter-and-encoding-viewer

# 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.

Breadcrumbs: Toolipedia > Text tools > Text tools > Text Byte Counter and Encoding Viewer

## 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?
- Private: everything happens in your browser. Nothing you enter is uploaded.
- Free, with no sign-up, no watermark and no limit on how often you use it.
- Works on phones, tablets and computers: Android, iPhone, Windows, Mac and Linux. Nothing to install.
- Free to embed on your own website, with a ready-made code to copy.

## Also known as
- text byte counter and encoding viewer
- how many bytes is my text
- utf-8 byte count
- utf-16 byte length
- utf-16 encoder decoder
- string size in bytes

## 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.

## Related tools

More free tools that go well with Text Byte Counter and Encoding Viewer:
- [Unicode character inspector](https://toolipedia.app/unicode-character-inspector)
- [URL encoder, decoder & parser](https://toolipedia.app/url-encoder)
- [Text to binary converter](https://toolipedia.app/text-to-binary)
- [Garbled Text Fixer](https://toolipedia.app/mojibake-fixer)
- [Compression and Coding Demos](https://toolipedia.app/compression-and-coding-demos)
