Text Size in Bytes Counter

See how many bytes your text takes up in UTF-8 and UTF-16, with kilobytes, ASCII and multi-byte character counts.

UTF-8 size

0bytes

Kilobytes

0.00KB

UTF-16 size

0bytes

Characters

0

ASCII characters

0

Multi-byte characters

0

Avg bytes / character

0.00

How big is your text in bytes?

Character counts measure text the way people read it. Byte counts measure it the way computers store it, and the two are often very different. An English sentence of 50 characters is usually 50 bytes, but a sentence of 50 characters in Japanese, Greek or a string of emoji can be two, three or four times larger. When a database column, an API, a message queue, an SMS gateway or a file format limits size in bytes, the character count can't tell you whether your text will fit. This byte counter can. Paste text above to see the UTF-8 size in bytes and kilobytes, the UTF-16 size, the number of characters, how many are plain ASCII and how many need more than one byte, and the average bytes per character.

How text becomes bytes

Computers store text as numbers, using an encoding to turn each character into one or more bytes. The two you'll meet most often are:

  • UTF-8, the dominant encoding on the web, in files, in most databases and in most APIs. It uses one byte for basic Latin letters, digits and punctuation (the ASCII range), two bytes for most accented Latin, Greek, Cyrillic, Hebrew and Arabic letters, three bytes for most other scripts including Chinese, Japanese, Korean and Indic scripts, and four bytes for most emoji and rarer characters.
  • UTF-16, used internally by JavaScript, Java, Windows and many other systems. It uses two bytes for most characters and four bytes for emoji and other characters outside the Basic Multilingual Plane.

So "hello" is 5 bytes in UTF-8 and 10 in UTF-16. "héllo" is 6 bytes in UTF-8, because é needs two, and still 10 in UTF-16. "こんにちは" is 15 bytes in UTF-8 and 10 in UTF-16. A single 👍 is 4 bytes in both.

The counter measures UTF-8 exactly, using the same encoder your browser uses. The UTF-16 figure is the number of UTF-16 code units multiplied by two, without a byte-order mark.

Why byte size matters

Database limits. Many databases define text column sizes in bytes, or in characters with a byte cap behind the scenes. MySQL's older utf8 encoding stored at most three bytes per character and couldn't store most emoji at all, which is why utf8mb4 exists. An index on a text column may also be limited to a fixed number of bytes.

API and payload limits. Push notification payloads, webhook bodies, message queue entries, cookie values and HTTP headers all have byte limits. Cookies, for example, are commonly limited to about 4,096 bytes each. If your payload is near the limit, a few emoji or non-Latin characters can push it over.

SMS. A standard SMS carries 140 bytes. With the GSM-7 alphabet, that's 160 characters of 7 bits each. As soon as a message contains a character outside GSM-7, such as an emoji or many non-Latin letters, it switches to UCS-2, which uses two bytes per character, and the limit drops to 70 characters.

File sizes and storage. When you estimate how large a text file, a translation memory or a dataset will be, the UTF-8 byte count is the number that matters.

Search and SEO tools. Some systems truncate fields by bytes rather than characters, which can cut a multi-byte character in half and produce garbled text at the end of a string.

Reading the results

The main figure is the UTF-8 size in bytes, with kilobytes underneath (1 KB = 1,024 bytes). The ASCII figure counts characters in the basic 128-character range, each of which is one byte in UTF-8. Multi-byte characters are everything else. The average bytes per character gives a quick sense of how "heavy" your text is. Plain English sits very close to 1.0, accented European text slightly above, Chinese and Japanese close to 3.0, and emoji-heavy text higher still.

Tips

  • When a limit is given in bytes, always check the byte count, not the character count.
  • Test with real data. Names, addresses and user-generated content often contain accented letters and emoji, even when the rest of your text doesn't.
  • Watch for invisible characters. Zero-width spaces and byte-order marks take three bytes each in UTF-8 but can't be seen. The Special Character Counter will find them.
  • Don't truncate by bytes naively. Cutting a UTF-8 string at an arbitrary byte can split a character. Truncate by characters, then check the bytes.

Byte limits you'll often meet

A few byte limits come up again and again in development and operations work. Exact values depend on the system and configuration, so check the documentation for yours, but these are useful reference points:

  • cookies: about 4,096 bytes per cookie, including the name and attributes;
  • SMS: 140 bytes per message segment;
  • many push notification services: payloads of a few kilobytes, often 4 KB;
  • DNS TXT records: 255 bytes per string, with longer values split into several strings;
  • URLs: no formal limit, but staying under about 2,000 characters avoids problems with older browsers, servers and proxies;
  • database indexes: many engines cap the size of an indexed key, often a few hundred to a few thousand bytes.

When you're designing a field that will hold user input, plan for the worst case, not the typical one. A name field that comfortably fits 50 English characters needs four times as many bytes if someone enters 50 emoji. Testing with real multilingual examples, measured here, catches these problems before they reach production.

Related tools

For the human-facing count, the Character Counter counts emoji and accented letters as one each. For emoji specifically, including their UTF-16 code units, use the Emoji Counter. For a full set of statistics on the same text, try the Text Statistics Calculator. Your text is encoded and measured locally, and nothing leaves your device.

How to use it

  1. 1

    Paste your text

    Any language, any characters, including emoji.

  2. 2

    Read the UTF-8 size

    The main figure is the exact UTF-8 byte count, the encoding used by the web, files and most APIs.

  3. 3

    Compare encodings

    See the UTF-16 size and the size in kilobytes.

  4. 4

    Check character weight

    ASCII, multi-byte and average bytes per character show what's driving the size.

Features

Exact UTF-8 size

Measured with your browser's own encoder.

UTF-16 too

The size used by JavaScript, Java and Windows.

Character weight

ASCII vs multi-byte characters and average bytes per character.

Private

Nothing is uploaded.

Preguntas frecuentes

How many bytes is one character?

In UTF-8, one byte for basic Latin letters and digits, two for most accented and Greek or Cyrillic letters, three for most Asian scripts, and four for most emoji.

What's the difference between UTF-8 and UTF-16 size?

UTF-8 uses one to four bytes per character. UTF-16 uses two or four. English text is smaller in UTF-8, while some Asian text is smaller in UTF-16.

Is a kilobyte 1,000 or 1,024 bytes?

This tool uses 1,024 bytes per kilobyte, the convention most operating systems and developers use for file sizes.

Why is my text bigger than its character count?

Accented letters, non-Latin scripts and emoji take more than one byte each in UTF-8.

Does the size include a byte-order mark?

No. Sizes are for the text alone, without a BOM.

Is my text uploaded?

No. It's measured in your browser.

Rate Text Size in Bytes Counter

No account needed, and ratings are anonymous.

How useful was this tool?
No ratings yet — be the first

Further reading

All articles →