Skip to tool
ecech.
📏 Productivity & Units

Text to Binary, Where One Emoji Turns Out to Be Eighteen Bytes

A is one byte, 中 is three, and a family emoji is eighteen. Convert both directions and see where the bytes actually go.

Visible characters

Code points

UTF-16 units

what .length gives

UTF-8 bytes

Character by character

Advertisement

How the calculation works

One character, one to eighteen bytes Aé 👍 1 byte2 bytes 3 bytes4 bytes plain ASCII, unchanged since 1963 accented Latin most CJK emoji and rarer scripts ASCII text is identical in UTF-8, which is why the encoding won.

How to Use This Tool

Type text and pick a base. The per-character table shows exactly how many bytes each one takes, which is where the surprises live.

Why one character is not one number

ASCII gave every character a number from 0 to 127, and one byte held it. That covered English and nothing else.

UTF-8 extends it: characters 0–127 stay exactly as they were in one byte, and everything else uses two, three or four. That backwards compatibility is why UTF-8 won — an ASCII file is already valid UTF-8, so the transition cost nothing.

The consequence is that "convert this character to binary" has no single answer without saying which encoding. Most tools assume UTF-8 without mentioning it, which is fine until someone pastes text from a system using something else.

Four different ways to count length

The panels above give four numbers for the same string, and they disagree for good reasons:

  • Visible characters — what a person would count. A family emoji is one.
  • Code points — Unicode's own unit. That family emoji is seven, because it is three people joined by zero-width joiners.
  • UTF-16 units — what JavaScript's .length returns. Emoji count as two each, which is why "👍".length is 2.
  • UTF-8 bytes — what goes over the network or into a file.

A database column of VARCHAR(10) may mean ten of any of these depending on the system, which is a reliable source of truncation bugs.

The same emoji, counted four ways 👨‍👩‍👧 visible characters1 code points7 UTF-16 units (.length)11 UTF-8 bytes18 Slicing this in the middle produces fragments that render as separate people.
Three emoji joined by zero-width joiners, which the renderer combines into one glyph.

Where this actually matters

  • Truncating strings. Cutting at a byte or UTF-16 boundary can split a character in half, producing a replacement glyph or a broken emoji. Slice by code point, or better by grapheme.
  • Length limits. A 160-character SMS is 160 GSM characters or 70 UTF-16 units once any non-Latin character appears — a different tool on this site covers that in detail.
  • URLs and forms. Non-ASCII characters become three escape sequences each when percent-encoded, so a query string with Chinese text is far longer than it looks.
  • Storage estimates. "One byte per character" is right for English and wrong by a factor of three for Chinese.

Reading binary back

Paste binary into the lower box and it converts back. The bytes need to be a valid UTF-8 sequence — a stray or reordered byte produces a replacement character rather than an error, which is UTF-8 behaving correctly and looking broken.

Advertisement

Frequently Asked Questions

How do you convert text to binary?
Encode each character to bytes, then write each byte as eight binary digits. The step people skip is the encoding: in UTF-8 an English letter is one byte, an accented letter two, a Chinese character three and an emoji four. There is no single binary form for a character without naming an encoding.
Why does one emoji take four bytes?
Because it sits outside the range that one, two or three bytes can address. UTF-8 uses a variable number of bytes, reserving the short forms for the most common characters, and emoji live high in the Unicode range. Composite emoji like a family are far larger still — eighteen bytes for three people joined together.
Why is "👍".length equal to 2 in JavaScript?
Because JavaScript measures strings in UTF-16 units and characters outside the basic range take two of them. It is not a bug, it is what .length has always meant. Use Array.from or the spread operator to count code points instead.
What is the difference between ASCII and UTF-8?
ASCII covers 128 characters in one byte each. UTF-8 keeps those first 128 exactly as they were and uses two to four bytes for everything else, so every ASCII file is already valid UTF-8. That backwards compatibility is the main reason UTF-8 became universal.
Why did my text turn into question marks or squares?
Usually because bytes encoded one way were read as another, so the reader saw sequences it could not interpret. UTF-8 substitutes a replacement character rather than failing, which is correct behaviour that looks like corruption. The fix is at the point the encoding was declared, not in the text.
How many bytes does a Chinese character take?
Three in UTF-8 for the common ranges. So a paragraph of Chinese is roughly three times the byte size of the same paragraph in English, which matters for storage estimates, URL length limits and any field measured in bytes rather than characters.

Related tools in Productivity & Units

Browse all Productivity & Units tools
The person who builds ecech., at the desk where the tools are written.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.