JavaScript unescape: read escaped strings
The JavaScript unescape tool interprets backslash escape sequences exactly as a JavaScript engine does when it parses a string literal. It is handy for reading minified bundles, log output that prints strings with \n instead of real line breaks, or localisation files full of \u00e9-style sequences.
Note that this has nothing to do with the deprecated global unescape() function, which decodes %XX percent sequences. For those, use the URL Decoder.
Supported sequences
- Single-character escapes:
\n \r \t \b \f \v \0 \\ \" \'and\/. - Two-digit hex:
\x41→ A. - Four-digit Unicode:
\u00e9→ é, and surrogate pairs like\uD83D\uDE80→ 🚀. - Code point escapes from ES2015:
\u{1F680}→ 🚀. - Line continuations: a backslash directly before a line break is removed along with the break.
Unknown escapes follow JavaScript’s lenient rule: the backslash is dropped and the character kept, so \q becomes q. A malformed Unicode escape such as \u12 is reported as an error with its position, just as a real parser would refuse it.
Example
Input:
Rocket: \u{1F680}\tHex: \x41\nCaf\u00e9 \qOutput:
Rocket: 🚀 Hex: A
Café q
Where escaped JavaScript strings come from
- Minified bundles. Minifiers and bundlers often write non-ASCII text as
\uXXXXescapes so the output is pure ASCII, which makes translated UI strings unreadable when you debug production code. - Logs and error reports. Anything printed with
JSON.stringifyor a debugger shows line breaks as\nand quotes as\". - Translation files and fixtures that were exported with ASCII-only settings, where every accented letter looks like
\u00e9. - Obfuscated snippets that hide readable words behind
\xescapes. Decoding them is a quick first step when reviewing unfamiliar code before you run it.
Tips
- Remove the outer quotes before pasting if you copied a whole literal; otherwise they stay in the output as ordinary characters.
- Decoded text can contain invisible characters such as tabs, NUL or zero-width spaces. Copy the output into a hex viewer if something looks right but still fails a comparison.
- If the text is JSON rather than JavaScript, JSON Unescape applies JSON’s stricter rules.
- To escape text again after editing it, switch to JavaScript Escape or edit the Raw text box here: the Escaped JavaScript box then updates with the escaped form.
Decoding runs in your browser; your code is not uploaded unless you click Save & Share to create a link.