Unicode Escape Converter

Turn text into the \u escapes that source code and JSON use, or paste an escaped string and read it as text. Characters beyond U+FFFF, such as emoji, are handled either way.

How it works

Every character has a Unicode number, its code point: é is U+00E9 and 😀 is U+1F600. An escape writes that number in hex after a backslash, so é becomes \u00e9 and code can contain any character while the file itself stays plain ASCII.

Encoding leaves plain ASCII alone and escapes everything else. A backslash is written as \\ so the result decodes back to exactly what you typed.

Decoding reads \uXXXX, \u{...}, \xXX and the usual \n, \t, \" and \\. It all runs on this page; nothing is sent anywhere.

How to use it

  1. 1 Pick Encode for text to escapes, or Decode for escapes to text.
  2. 2 When encoding, choose how characters beyond U+FFFF are written: \u{1f600} for modern JavaScript, or a pair like \ud83d\ude00 for JSON, Java and C#.
  3. 3 Type or paste into the first box. The result appears as you type.
  4. 4 Copy the result or download it as a .txt file. Swap moves it back into the first box.

Good to know

  • JSON has no \u{...} form. If the result is going into JSON, use the pair style.
  • An escape the decoder does not know, like \p in C:\path, is left as written rather than refused.
  • Half a surrogate pair, such as \ud83d with nothing after it, is reported as an error, because it is not a character on its own.
  • Escapes are not encryption or obfuscation. Any browser console reads them back in a second.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Why one emoji needs two \u escapes, and what the halves mean

Unicode gives every character a number called its code point. The letter A is U+0041, é is U+00E9, 日 is U+65E5 and 😀 is U+1F600, where the digits after U+ are hexadecimal. A Unicode escape is a way to write a character by its number instead of by its shape, using only plain ASCII. In JavaScript, JSON, Java, C# and many other languages, \u00e9 inside a string means é. That is useful whenever a file has to stay ASCII, when a character is invisible or easy to confuse, such as a non-breaking space (\u00a0) or a zero-width joiner (\u200d), or when you want to see exactly which character a string holds.

Encode "café" here and you get caf\u00e9: plain letters stay as they are and only the é is escaped. The four hex digits after \u are the code point itself, padded with zeros. Four hex digits can reach FFFF, which is 65,535, and when these escapes were designed that was meant to be every character there would ever be. It was not. Unicode now runs to 10FFFF, and everything past FFFF, including emoji, many historic scripts and rarer Chinese characters, does not fit in four digits.

Languages that had already committed to 16-bit characters solved this with surrogate pairs. A code point beyond FFFF is split into two 16-bit halves taken from a range reserved for nothing else. For 😀, subtract 10000 from 1F600 to get F600, which is twenty bits. The top ten bits, 3D, are added to D800 to give the high half D83D; the bottom ten bits, 200, are added to DC00 to give the low half DE00. So 😀 is written \ud83d\ude00. Neither half is a character by itself, which is why "\ud83d" on its own is reported here as an error: it is half of something whose other half is missing. It is also why "😀".length is 2 in JavaScript.

Since 2015, JavaScript has had a second form, \u{1f600}, with braces around up to six hex digits. It writes the code point directly, with no arithmetic, and Rust and Swift use the same idea. The catch is that JSON never adopted it: a JSON parser will reject \u{1f600}. That is why the encoder offers both styles. The brace style is easier to read and is the default; the pair style is what you need for JSON, Java and C#. The decoder reads either, and combines a correct pair into the single character it stands for.

The decoder also reads the other escapes that turn up in the same strings: \n for a new line, \t for a tab, \" and \' for quotes, \\ for a backslash and \x41 for a character from 0 to FF. That covers most strings copied out of JSON, logs and source code. An escape it does not know, such as the \p in C:\path, is left exactly as written, because a backslash in pasted text is more often part of a Windows path than a mistake. Malformed escapes, such as \u with fewer than four hex digits or a number past 10FFFF, are reported with their position so you can find them.

Frequently asked questions

Why is 😀 written as two escapes, \ud83d\ude00?

Because \u takes exactly four hex digits, which only reach U+FFFF, and 😀 is U+1F600. JSON, Java, C# and older JavaScript store such characters as two 16-bit halves, called a surrogate pair, and escape each half. Modern JavaScript also accepts \u{1f600}, which writes the code point directly.

Which style should I choose?

For JavaScript or TypeScript written since 2015, Rust or Swift, \u{1f600} is clearer. For JSON, Java, C# or anything older, choose the pair. Both decode to the same character here.

Can I paste a string straight out of JSON or a log file?

Yes. The decoder reads \n, \r, \t, \", \', \/ and \\ as well as the Unicode escapes, so an escaped JSON string or a log line comes back as readable text.

Why does the decoder reject \u{110000}?

U+10FFFF is the last code point Unicode has, so 110000 does not stand for a character. The decoder points at the escape rather than guessing.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.