Unicode Escape Converter
About this tool
About Unicode Escape Converter
Source files, JSON payloads and log lines often need non-ASCII characters written as escape sequences, and the syntax differs by language. This converter writes them in the exact form each one expects: JavaScript and Java \uXXXX with surrogate pairs for emoji, ES6, Rust and Swift \u{1F600}, Python and C/C++ \u and \U0001F600, JSON strings with \n and \" short forms, HTML hex or decimal character references, and CSS \1F600 with the terminating space added only when it is needed. Choose Non-ASCII only to keep plain English readable, or Every character for fully escaped output, with lowercase or uppercase hex. Unescape works the other way and accepts a mixture of styles in one paste, joins surrogate pairs, tells you which kinds of escape it found and warns about unpaired surrogates that would corrupt text. Literal backslashes are escaped too, so the result always round-trips. Conversion happens locally in your browser, so strings from private code never leave your machine.
Built and maintained by Abhi JainUpdated
How to Escape and Unescape Unicode
- 1
Pick a direction
Choose Escape to turn text into escape sequences, or Unescape to turn escapes back into text.
- 2
Choose the style
For Escape, pick the Style for your language and whether to escape Non-ASCII only or Every character.
- 3
Paste and copy
Paste your text into the left pane. The result appears on the right; copy it, download it, or click Use as input to reverse it.
Unicode Escape Converter: questions and answers
Why is an emoji written as two \u escapes in JavaScript?
JavaScript strings are UTF-16. Characters above U+FFFF, such as most emoji, are stored as a surrogate pair, so 😀 (U+1F600) becomes \ud83d\ude00. ES6 also accepts the shorter \u{1f600}, which this tool writes when you choose the ES6 style.
What is the difference between \u and \U in Python?
In Python string literals, \u takes exactly four hex digits and covers U+0000 to U+FFFF, while \U takes exactly eight and covers every code point, for example \U0001F600. C and C++ universal character names use the same two forms.
How do I decode \u00e9 back to é?
Switch to Unescape and paste the text. Every \uXXXX, \u{…}, \UXXXXXXXX, \xHH, &#x…; and &#…; sequence is decoded, even when several styles are mixed together.
When does a CSS escape need a trailing space?
A CSS escape is a backslash followed by up to six hex digits. If the next character is itself a hex digit or a space, it would be read as part of the escape, so a single space ends it: \e9 a. The converter adds that space only where it is required.
Does escaping change the text?
No. Escapes are just another way of writing the same characters inside source code or markup. Once a compiler, parser or browser reads them, the string is identical to the original.
Related Tools
- Unicode Code Point ConverterConvert text to U+ code points, hex or decimal, see UTF-8 and UTF-16 per character, and convert back.
- HTML Entity EncoderEscape text to HTML entities (named, decimal or hex) and decode entities back to characters.
- Unicode Character InspectorSee every character's code point, name, category, script and UTF-8/UTF-16 bytes.
- URL EncoderPercent-encode and decode URLs and query values with encodeURIComponent, encodeURI or form encoding.
- JSON FormatterBeautify, minify and validate JSON with exact error locations, without changing a single value.