TOOLTIKI Lovable tool, really free
Developer Encoding

Unicode converter

What you would call characters
6
Code points
6
UTF-16 code units
7
UTF-8 bytes
10
CharCode pointUTF-8UTF-16HTMLJSBlock
CU+0043430043C\u0043Basic Latin (ASCII)
aU+0061610061a\u0061Basic Latin (ASCII)
fU+0066660066f\u0066Basic Latin (ASCII)
éU+00E9C3 A900E9é\u00E9Latin-1 Supplement
U+0020200020 \u0020Basic Latin (ASCII)
😀U+1F600F0 9F 98 80D83D DE00😀\u{1F600}Emoji and pictographs

Inspected in your browser · nothing is uploaded

Local · graphemes, code points, units and bytes
Advertisement
320 × 100

Breaks text into code points and shows each one’s UTF-8 bytes, UTF-16 units, HTML entity and JavaScript escape — plus the four different ways of counting characters, which almost never agree.

How to use the unicode converter

1 Paste the text you are puzzled by.
2 Read the four counts — they disagree, and the difference is usually the answer.
3 Copy the escape you need.

The four counts are the point of this page, because the gap between them explains most Unicode bugs. A grapheme is what a person calls a character. A code point is what Unicode calls one. A UTF-16 code unit is what JavaScript’s .length counts. A UTF-8 byte is what a database column measures. For plain English all four are equal, which is why the problem stays hidden until the first emoji arrives.

Take 😀: one grapheme, one code point, two UTF-16 units and four UTF-8 bytes. So "😀".length is 2 in JavaScript, and slicing that string at position 1 splits it into two halves of a surrogate pair — neither of which is a character, which is how you get the replacement diamond in production. A family emoji is worse: one grapheme, five code points, eleven UTF-16 units.

That byte count is where database errors come from. A MySQL column declared utf8 holds three bytes per character, and every emoji needs four — which is why the column has to be utf8mb4, and why an emoji silently vanishing between a form and a page is nearly always this.

The escapes are given in all four forms because the syntax differs by more than notation. Above the Basic Multilingual Plane, JavaScript needs \u{1F600} with braces — the older \uXXXX form simply cannot express a code point above FFFF, and writing it is a silent bug rather than an error.

Questions

It counts UTF-16 code units, and an emoji is two. Slicing at position 1 splits a surrogate pair and produces a replacement diamond.

The Unicode StandardUTS #18 — Unicode regular expressions
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING