Unicode Escape
Escape non-ASCII characters as \\uXXXX. Pick classic or ES6 syntax.
EscapeUnicodeClient-sideFree to use
Switch to unescape
Syntax
0 / 500,000
Try It Out
How to use
- Paste your text. Unicode, emoji, anything.
- Pick output syntax. Classic \u or ES6 \u{}.
Common use cases
- Safely embedding unicode in JS source
- Debugging encoding issues
- Auditing non-ASCII content
Frequently asked questions
- What is this tool best used for?
- Unicode escaping is most useful when you need to embed non-ASCII characters safely inside source code, configuration files, or JSON payloads that must survive ASCII-only transmission. Common cases include JavaScript string literals, Java .properties files, and C# verbatim strings where non-ASCII characters might be misread by editors or build tools.
- What is the difference between classic \uXXXX and ES6 \u{XXXXX} syntax?
- Classic \uXXXX encodes a single UTF-16 code unit as four hex digits. Characters outside the Basic Multilingual Plane (code points above U+FFFF, such as most emoji) require two classic escapes called a surrogate pair. ES6 \u{XXXXX} encodes the actual Unicode code point directly in one escape sequence, which is unambiguous and easier to read. Use ES6 syntax for modern JavaScript; use classic syntax for Java, older JSON parsers, and any environment that does not understand \u{}.
- Does this tool send my text to a server?
- No. All conversion happens in your browser. Your text is not transmitted anywhere.
- What are surrogate pairs and when do they appear?
- UTF-16 represents characters outside the Basic Multilingual Plane using two 16-bit values called a surrogate pair, in the range \uD800-\uDFFF. Emoji such as 😀 and rare CJK unified ideographs are examples. In classic mode this tool emits both surrogates (for example \uD83D\uDE00 for 😀). In ES6 mode it emits the single code point \u{1F600} instead.
- How is \uXXXX different from percent-encoding?
- Percent-encoding (URL encoding) uses a % sign followed by the two-digit hex value of each byte, for example %20 for a space. It operates on bytes and is designed for URLs and HTTP. Unicode escaping uses \u followed by a four-digit hex code point and is designed for source code string literals. The two formats are not interchangeable.
Related tools
How to use
- Paste your text. Unicode, emoji, anything.
- Pick output syntax. Classic \u or ES6 \u{}.
Common use cases
- Safely embedding unicode in JS source
- Debugging encoding issues
- Auditing non-ASCII content
Frequently asked questions
- What is this tool best used for?
- Unicode escaping is most useful when you need to embed non-ASCII characters safely inside source code, configuration files, or JSON payloads that must survive ASCII-only transmission. Common cases include JavaScript string literals, Java .properties files, and C# verbatim strings where non-ASCII characters might be misread by editors or build tools.
- What is the difference between classic \uXXXX and ES6 \u{XXXXX} syntax?
- Classic \uXXXX encodes a single UTF-16 code unit as four hex digits. Characters outside the Basic Multilingual Plane (code points above U+FFFF, such as most emoji) require two classic escapes called a surrogate pair. ES6 \u{XXXXX} encodes the actual Unicode code point directly in one escape sequence, which is unambiguous and easier to read. Use ES6 syntax for modern JavaScript; use classic syntax for Java, older JSON parsers, and any environment that does not understand \u{}.
- Does this tool send my text to a server?
- No. All conversion happens in your browser. Your text is not transmitted anywhere.
- What are surrogate pairs and when do they appear?
- UTF-16 represents characters outside the Basic Multilingual Plane using two 16-bit values called a surrogate pair, in the range \uD800-\uDFFF. Emoji such as 😀 and rare CJK unified ideographs are examples. In classic mode this tool emits both surrogates (for example \uD83D\uDE00 for 😀). In ES6 mode it emits the single code point \u{1F600} instead.
- How is \uXXXX different from percent-encoding?
- Percent-encoding (URL encoding) uses a % sign followed by the two-digit hex value of each byte, for example %20 for a space. It operates on bytes and is designed for URLs and HTTP. Unicode escaping uses \u followed by a four-digit hex code point and is designed for source code string literals. The two formats are not interchangeable.