FormatterHQ

JavaScript String Unescape

Paste an escaped JavaScript string and get the real text back. Decodes every sequence the language supports, including \u{…} code points and line continuations.

Loading tool…
Ready.

How to use the JavaScript Unescape

  1. Type or paste into the Escaped JavaScript box, or click Sample. You can also drop a text file on either box, or load one into the Escaped JavaScript box with its Open file button.
  2. The Raw text box updates live as you type. It works both ways — edit the Raw text side to convert back, or click ⇄ Swap to exchange the sides.
  3. Escape non-ASCII as \uXXXX in the options bar above the editors only affects the reverse direction — the Escaped JavaScript output you get when you type in the Raw text box.
  4. Use Copy or Download on either box to take the result, or Clear to start again.

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 \q

Output:

Rocket: 🚀	Hex: A
Café q

Where escaped JavaScript strings come from

  • Minified bundles. Minifiers and bundlers often write non-ASCII text as \uXXXX escapes 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.stringify or a debugger shows line breaks as \n and 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 \x escapes. 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.

Frequently asked questions

Is this the same as the JavaScript unescape() function?
No. The legacy global unescape() decodes %XX and %uXXXX URL-style sequences. This tool decodes the backslash escapes used inside string literals. For percent-encoding use a URL decoder.
Does it support \u{…} escapes?
Yes. ES2015 code point escapes with one to six hex digits, up to \u{10FFFF}, are decoded to the correct character, including emoji.
What happens to an unknown escape like \q?
JavaScript ignores the backslash in non-special escapes, so \q becomes q. The tool follows the same rule.
Why do I get “Invalid unicode escape”?
A \u must be followed by exactly four hex digits or by {…}. Something like \u12 or \uZZZZ is a syntax error in JavaScript as well.

Last updated October 3, 2026

Related tools