BYTETOOLS

String Byte Size Calculator

Measure a string's size in UTF-8, UTF-16 and Latin-1 bytes, plus code units and Unicode code points. See why emoji count differently. Free online tool.

0
UTF-8 bytes
0
UTF-16 bytes
0
Latin-1 bytes
0
UTF-16 code units (.length)
0
Unicode code points
0 B
UTF-8 size (human)

What is the String Byte Size Calculator?

The ByteTools String Byte Size Calculator measures a piece of text every way that matters: UTF-8 bytes (what databases, files and HTTP payloads usually store), UTF-16 bytes (what JavaScript and Java hold in memory), Latin-1 bytes where representable, UTF-16 code units (JavaScript's .

  • UTF-8, UTF-16 and Latin-1 byte counts side by side
  • UTF-16 code units (JavaScript .length) vs Unicode code points
  • Detects characters outside the Latin-1 range
  • Human-readable size via KB formatting
  • Built-in explanation of why the counts differ
  • 100% client-side and live

How to use the String Byte Size Calculator

  1. 1

    Paste or type the text you want to measure.

  2. 2

    Read the UTF-8, UTF-16 and Latin-1 byte counts instantly.

  3. 3

    Compare code units (.length) with true code points to spot astral characters.

  4. 4

    Check the note if the text cannot be represented in Latin-1.

About the String Byte Size Calculator

The ByteTools String Byte Size Calculator measures a piece of text every way that matters: UTF-8 bytes (what databases, files and HTTP payloads usually store), UTF-16 bytes (what JavaScript and Java hold in memory), Latin-1 bytes where representable, UTF-16 code units (JavaScript's .length) and true Unicode code points.

The distinctions bite constantly in real work: an emoji is 4 UTF-8 bytes and 2 code units but a single code point; a VARCHAR(255) column measured in bytes holds fewer accented characters than you think; an SMS or a Redis key has byte limits, not character limits. This tool shows all the counts side by side and explains the differences under the result.

Everything is computed live and 100% locally in your browser. Your text is never uploaded, logged or stored.

Frequently asked questions

How many bytes is a character in UTF-8?

Between 1 and 4. ASCII letters, digits and punctuation take 1 byte; most accented Latin, Greek, Cyrillic, Hebrew and Arabic letters take 2; most CJK characters take 3; and emoji and other supplementary-plane characters take 4. That variability is exactly why you measure real strings rather than multiplying character count by a constant.

Why is an emoji's .length 2 in JavaScript?

JavaScript strings are sequences of UTF-16 code units, and characters beyond U+FFFF — including nearly all emoji — need a surrogate pair of two units. So '😀'.length is 2 even though it is one code point. Use Array.from(str).length or the spread operator to count code points instead.

What is the difference between characters and bytes?

A character (code point) is a unit of text; a byte is a unit of storage, and an encoding maps one to the other. The same 10-character string can be 10 bytes in Latin-1, 10 to 40 bytes in UTF-8 and exactly 20 or more in UTF-16 — which is why database limits, HTTP headers and SMS segmentation all care about the encoding.

When does Latin-1 show as not applicable?

Latin-1 (ISO-8859-1) is a single-byte encoding covering only code points 0 to 255 — Western European letters plus symbols. If your text contains anything outside that range, such as ć, 中 or any emoji, it simply cannot be encoded in Latin-1, and the tool tells you how many characters are the problem.

Is my text sent anywhere to be measured?

No. Counting is done in your browser with the standard TextEncoder API and JavaScript string operations. Nothing you paste is transmitted, logged or stored.

Related tools