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
.lengthreturns. Emoji count as two each, which is why"👍".lengthis 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.
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.
