1. Home
  2. Developer tools
  3. UTF-8 Byte Counter

UTF-8 Byte Counter

Databases, HTTP headers, SMS segments and API fields limit bytes, not characters, and a single accented letter or emoji can take two to four bytes. Paste text to see its size in each encoding and whether it fits.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use UTF-8 Byte Counter

  1. Paste the text.
  2. Read the byte count and hex for each encoding.
  3. Enter a byte limit to check it or cut the text to fit.

Features

  • UTF-8, UTF-16 and UTF-32 sizes in both byte orders
  • Hex dump of the bytes
  • Optional byte order mark
  • Cuts text to a byte limit without splitting a character
  • Decodes hex bytes back to text
  • Counts code points, visible characters and JavaScript length

Supported formats

Input

  • Typed or pasted text
  • Hex bytes

You get

  • Byte counts
  • Hex dump
  • TXT

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the UTF-8 Byte Counter is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Lone surrogate halves cannot be encoded as UTF-8 and are replaced by U+FFFD.
  • Legacy encodings such as Windows-1252 are not counted; only UTF-8, UTF-16 and UTF-32 are.

Guide

Counting bytes in UTF-8, UTF-16 and UTF-32

A character count tells you what a reader sees, but computers store, send and limit bytes. The two numbers agree only for plain English text, and the gap grows with every accent, symbol or emoji. This page measures the byte length of any text in the Unicode encodings people actually use, shows the bytes, and helps when a limit is in the way.

How UTF-8 spends bytes

UTF-8 uses one byte for the 128 ASCII characters, two bytes for code points up to U+07FF (which covers Latin letters with accents, Greek, Cyrillic, Hebrew and Arabic), three bytes up to U+FFFF (most Asian scripts, the euro sign and many symbols), and four bytes beyond that (emoji and rare scripts). The page lists the bytes in hexadecimal, so you can see that é is C3 A9, the euro sign is E2 82 AC and a smiling face is F0 9F 98 80.

UTF-16 and UTF-32

UTF-16 uses two bytes for code points up to U+FFFF and four bytes, a surrogate pair, above that. This is the encoding behind JavaScript strings, Java and Windows APIs, and it is why the JavaScript length of an emoji is 2. UTF-32 always uses four bytes. Each of the two comes in big-endian and little-endian forms, which differ only in the order of the bytes of each unit; the table shows both. The counts exclude a byte order mark unless you switch the option on.

Byte limits

Enter a limit and the page tells you whether the UTF-8 size fits. If it does not, it shows how many bytes are over, offers the text cut to the last whole character that fits, and says how many characters were removed. The cut never splits a multi-byte sequence, which is what causes the replacement characters seen in truncated text. Use it for database columns, HTTP headers, cookie values and fields in APIs that measure bytes.

Decoding bytes

The second mode runs the other way. Paste hexadecimal bytes, with or without spaces, choose the encoding, and the page shows the text and the code points. Latin-1 is included for data from older systems. If the bytes are not valid in the chosen encoding, an error message explains which sequence failed, which helps when you are not sure which encoding a log or a file used.

A worked example

The Sample button loads “Héllo, wörld! € 日本語 😀”. It has 21 code points, and the same number of visible characters, but its JavaScript length is 22 because the emoji takes two UTF-16 units. In UTF-8 it takes 34 bytes, in UTF-16 44 bytes and in UTF-32 84 bytes. With a limit of 20 bytes the page keeps the text up to and including the space after the euro sign, which is exactly 20 bytes, and drops the Japanese characters whole instead of cutting one in the middle.

Limits

Only the Unicode encodings listed are counted. Windows-1252, Shift JIS, GBK and other legacy code pages are not, and neither is Base64 or URL-encoded size. Lone surrogate halves cannot be written in UTF-8, so they appear as the replacement character. The page counts the text you paste after your browser has normalised line endings, so a file with Windows line breaks may differ from the count your system reports.

Checked against the current version of the UTF-8 Byte Counter on .

Troubleshooting

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

Why can a field limited to 255 characters hold fewer than 255 letters?

Some databases and protocols measure bytes. A column of 255 bytes holds 255 English letters but only 127 two-byte letters such as é or ü, and 63 four-byte emoji. Check whether the limit is in bytes or in characters before choosing a size.

What is a byte order mark and do I need one?

It is the code point U+FEFF placed at the start of a file so a reader can detect UTF-16 or UTF-32 byte order. UTF-8 has no byte order, so its mark (EF BB BF) is optional and often unwelcome, because it can confuse scripts and tools that expect plain ASCII at the start of a file.

Why is "é" two bytes?

UTF-8 uses one byte only for ASCII. Characters from U+0080 to U+07FF, which include most accented Latin letters, take two bytes; é is the bytes C3 A9.

What happens when text is cut in the middle of a character?

The remaining bytes are invalid UTF-8 and show as a replacement character. The cut tool here stops before the character that does not fit.

Keep working with the result

After you download, choose “Save to Workstand” to keep the result in a folder on your computer, attach it to a project and create a follow-up task. It is saved by your browser, not uploaded.