Unicode Escape Converter
Convert text to Unicode escapes (\uXXXX, \u{…}, %u, U+, &#x, 0x) or decode them back. JavaScript, JSON, Python-friendly. In-browser, no registration.
Format and usage
Escape: pick output format (\uXXXX, ES6 \u{code point}, legacy %uXXXX, U+, HTML &#x…;, 0x…). Unescape: pick a format or use Auto-detect for mixed input. In Unescape mode, Insert adds \u, \u{, or %u depending on the format. Max 10,000 characters.
How to use
About this tool
Convert text to Unicode escapes or decode them back in real time. Supports \uXXXX, ES6 \u{…}, legacy %uXXXX, U+, HTML &#x…;, and 0x…. JavaScript, JSON, Python-friendly; all in your browser.
How to use
In Escape mode, pick the output format. In Unescape, turn on Auto-detect for mixed input or pick a single format. Type or paste; results update instantly. In Unescape, Insert adds \u, \u{, or %u depending on the format.
Options
Escape: choose output among \uXXXX, \u{…}, %uXXXX, U+, &#x, 0x. Unescape: pick a format or Auto-detect (mixed input). For code-point–first workflows see the Unicode Encode/Decode tool. Max 10,000 characters.
Use cases
• Inspecting and converting escaped strings in JavaScript/JSON • Decoding \uXXXX in logs and error messages • Exchanging multilingual text in escape form • Preparing Unicode for regex or code
Code Examples
1// \uXXXX (manual)
2"Hello".split('').map(c => '\\u' + c.charCodeAt(0).toString(16).padStart(4,'0')).join('');
3
4// ES6 \u{…} for astral code points
5"\\u{1f600}" // 😀 in a string literal
6
7// Unescape from JSON
8JSON.parse("\u0048\u0065\u006c\u006c\u006f"); // "Hello"1# Decode \uXXXX in a byte string with backslashes
2s = "\\u0048\\u0065\\u006c\\u006c\\u006f"
3s.encode().decode("unicode_escape") # "Hello"
4
5import codecs
6codecs.decode("\\u3042", "unicode_escape") # "あ"1// Pass valid JSON (string in double quotes)
2json_decode('"\u0048\u0065\u006c\u006c\u006f"'); // "Hello"
3
4// Laravel: same as PHP; use json_decode on JSON text from config/APIHow it works
\uXXXX: BMP uses four hex digits; astral uses a UTF-16 surrogate pair. \u{…}: ES6 code point escapes. %uXXXX: UTF-16 code units (legacy-style). U+, &#x, 0x follow the same rules as our Unicode Encode/Decode tool. Auto-detect scans left-to-right with longest-match tokens; other characters pass through.
Privacy and data
Conversion is done in the browser; input and results are never sent to a server.
FAQ
- Q: What is a Unicode escape sequence?
- A: A way to write a character by its code point. \uXXXX uses four hex digits (JavaScript/JSON). \u{…} (ES6) can use one to six hex digits for any code point, including emoji in a single escape.
- Q: What is the difference between Escape and Unescape mode?
- A: Escape turns plain text into the selected escape format. Unescape turns escaped text back; you can pick a format or use Auto-detect for mixed \u, \u{…}, %u, U+, &#x, and 0x tokens.
- Q: How do I decode unicode escape sequences in Python?
- A: If your string contains backslashes like \u0048, use s.encode().decode("unicode_escape") on the str, or codecs.decode(s, "unicode_escape"). For actual JSON text, use json.loads() which decodes \uXXXX automatically.
- Q: Why does my JSON contain \uXXXX characters?
- A: JSON allows non-ASCII characters to be written as \uXXXX for ASCII-safe files, compact logs, or generator settings. json.dumps(..., ensure_ascii=True) emits them; parsers decode them back to Unicode.
- Q: What's the difference between \uXXXX and \u{XXXXX}?
- A: \uXXXX is the classic form: exactly four hex digits, one UTF-16 code unit (BMP) or two escapes for a surrogate pair. \u{…} is ES6: one escape for the full code point, e.g. \u{1F600} for 😀.
- Q: How to unescape unicode in PHP/Laravel?
- A: Wrap the value in a JSON string and call json_decode('"\u0041"') → "A". For API responses, decode the JSON body first; Laravel's json() helper returns already-decoded strings.
- Q: Does this tool support emoji or characters outside the BMP?
- A: Yes. In \uXXXX mode, astral characters use a surrogate pair. In \u{…} mode, one braced escape holds the full code point. %uXXXX follows legacy UTF-16 units.
- Q: Is this the same as the Unicode Encode/Decode tool?
- A: This tool focuses on backslash-style and %u escapes plus U+/HTML/0x. The Unicode Encode/Decode tool is optimized for code-point notation (U+, entities, 0x) with the same decode engine for those formats.
- Q: Is there a character limit?
- A: Yes — 10,000 characters per input.
