UTF-8 Byte Counter

Shows how many bytes a text takes in UTF-8, along with a breakdown by character type. It is useful when a database column, message or header has a byte limit, since accented letters and emoji take more than one byte.

Up to 1 MiB.

Results

Results appear here.

Options

How to use the UTF-8 Byte Counter

  1. Paste your text. The exact number of bytes it takes in UTF-8 is shown as you type.
  2. Choose how line breaks are counted if the text will be saved on Windows (CRLF) or Linux and macOS (LF).
  3. Turn on Include a byte order mark if your file or system adds one.

Why bytes differ from characters

  • In UTF-8, ASCII letters take 1 byte, accented letters 2 bytes, Chinese characters 3 bytes and emoji 4 bytes per code point. The table shows how many of each your text contains.
  • Some limits, such as database columns, SMS segments and HTTP headers, count bytes rather than characters.

Limitations

Worked examples

Mixed scripts and emoji

Input

A é 中 😀

Result

UTF-8 bytes: 13
Kilobytes (1 KB = 1,000 bytes): 0.01
Characters: 7
Unicode code points: 7
UTF-16 bytes: 16

Bytes each	Examples	Code points	Bytes
1	ASCII letters, digits, space	4	4
2	Accented Latin, Greek, Cyrillic, Arabic, Hebrew	1	2
3	Most other scripts: Chinese, Japanese, Hindi, Thai	1	3
4	Emoji and rare characters	1	4
Accented text with a line break

Input

naïve café
OK

Result

UTF-8 bytes: 15
Kilobytes (1 KB = 1,000 bytes): 0.01
Characters: 13
Unicode code points: 13
UTF-16 bytes: 26

Bytes each	Examples	Code points	Bytes
1	ASCII letters, digits, space	11	11
2	Accented Latin, Greek, Cyrillic, Arabic, Hebrew	2	4
3	Most other scripts: Chinese, Japanese, Hindi, Thai	0	0
4	Emoji and rare characters	0	0

Practical uses

  • Checking a database field limit

    A developer checks the byte size of a name that includes accents and Chinese characters, because the database column limit counts bytes rather than characters. The tool shows the exact UTF-8 byte total and how many characters take one, two, three or four bytes. The developer can see whether the name will fit before saving it.

  • Estimating file size for a text export

    An analyst pastes text and chooses how line breaks are counted, with CRLF for Windows or LF for Linux and macOS. Turning on the byte order mark option adds those bytes if the file will include one. The total gives a good idea of how large the saved file will be.

Privacy: this tool runs entirely in your browser. Your text is not uploaded, logged or saved, and it is never sent to analytics. Maximum input: 1 MiB.