Unicode Converter

Turn characters into \u escapes, code points and UTF-8 bytes, or decode escapes such as \u00e9 and U+1F600 back into text.

Runs in your browser — nothing is uploaded

Escaped (JavaScript and JSON)
Code points
UTF-8 bytes (hex)

Characters above U+FFFF are written as surrogate pairs, the form JavaScript and JSON use. Code points and UTF-8 bytes are shown for debugging mojibake, where the byte sequence reveals which encoding was used.

About the Unicode Converter

Unicode assigns a number, called a code point, to every character. Programming languages and data formats write those numbers in different ways: JavaScript and JSON use \uXXXX escapes, Python and Go use \U forms, the Unicode standard writes U+ notation, and files store the bytes of a chosen encoding such as UTF-8.

Characters outside the Basic Multilingual Plane, such as most emoji, need two 16-bit surrogate escapes in JavaScript and JSON. This converter writes them that way, and the decoder joins them back together. It also accepts the braced \u{1F600} form used in modern source code.

Showing code points and UTF-8 bytes side by side helps with mojibake. A sequence such as C3 A9 is the UTF-8 encoding of é, so if you see é on a page, the text was decoded with the wrong charset somewhere along the way.

FAQ

Unicode Converter — frequently asked

What is the difference between \u00e9 and \u{E9}?

They name the same code point, U+00E9. The fixed four-digit form \uXXXX works in JavaScript strings and JSON, while the braced form \u{...} needs ES2015 or later and can hold any code point up to U+10FFFF.

Why does an emoji become two \u escapes?

Most emoji are above U+FFFF, which does not fit in one 16-bit code unit. UTF-16, which JavaScript strings use, represents them as a high and a low surrogate. JSON escapes follow the same rule, so 😀 becomes 😀.

How do I tell which encoding produced mojibake?

Look at the UTF-8 bytes. The character é is C3 A9 in UTF-8, but if the bytes were read as Windows-1252 they show as é. Recognising that pattern tells you the file is UTF-8 that was opened as a single-byte charset.

Does decoding handle invalid escapes?

Only well-formed escapes are replaced: four hex digits after \u, braces around up to six hex digits, or U+ followed by four to six digits. Anything else stays unchanged, so ordinary backslashes in code are not disturbed.

Is a lone surrogate valid?

Not in well-formed text. A high surrogate must be followed by a low surrogate. If you decode only half of a pair, the result contains an unpaired surrogate that many systems display as a replacement character.

Does this tool send my text anywhere?

No. Encoding and decoding use JavaScript’s built-in string and TextEncoder functions in your browser.

    Report an issue