JavaScript Unescape

Unescape JavaScript strings back to plain text.

Local Your input is processed locally in your browser. Found a problem? Report an issue

What JavaScript Unescape does

JavaScript Unescape decodes the escape sequences of a JavaScript string literal, as a browser does when it reads the code. It understands every form the language has: \xHH, \uXXXX, \u{1F600}, the short escapes, legacy octal escapes such as \101 and a backslash at the end of a line (a line continuation, which disappears).

As in non-strict JavaScript, a backslash before any other character just yields that character, so \q becomes q. A malformed \x or \u escape is reported as an error, because JavaScript rejects it too.

JavaScript Unescape examples

The built-in sample

Input

say \"hello\" & <b>bye</b>

Output

say "hello" & <b>bye</b>

This is the input that the Load sample button fills in.

Every escape form

Input

\x41\u0042\u{1F600} \101 \'ok\' \q

Output

AB😀 A 'ok' q

Hex, \u, code point and octal escapes, escaped quotes and an identity escape (\q).

A broken escape

Input

price: \x4

Result

\x must be followed by two hex digits (line 1, column 8)

\x needs exactly two hex digits, so this is an error, with its position.

Each output was produced by running this tool on the input above it.

How it works

Each backslash sequence is replaced as shown below.

Escaped formCharacter
\n \r \t \b \f \vthe control characters
\0U+0000
\xHHthe character with that hex code
\uXXXXa UTF-16 code unit
\u{X…}a code point, up to 10FFFF
\101octal, up to \377 (legacy)
backslash + line breaknothing (line continuation)
\ + any other characterthat character

Details and limits

  • Strict-mode code and template literals reject octal escapes; this tool decodes them because older code still contains them.
  • Paste the inside of the literal, without its quotes. To escape text, use JavaScript Escape.

Questions

Is my data uploaded when I use JavaScript Unescape?

No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.

What does JavaScript Unescape do?

JavaScript Unescape decodes the escape sequences of a JavaScript string literal, as a browser does when it reads the code.

Are there any limits I should know about?

Strict-mode code and template literals reject octal escapes; this tool decodes them because older code still contains them. Paste the inside of the literal, without its quotes. To escape text, use JavaScript Escape.

Is there a size limit?

There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.

Does it work on phones, and is it free?

Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.