JavaScript Unescape String
Turn an escaped JavaScript string back into the text it represents. Paste a string literal from source code, a log or a stack trace, with or without its quotes, and every escape sequence is decoded: line breaks, tabs, quotes, backslashes, hexadecimal \xNN, Unicode \uXXXX and \u{…} code points. Invalid escapes are reported with their position, and invisible characters can be made visible.
- Runs in your browser
- No sign-up
- Free to use
How to use JavaScript Unescape String
- Paste the escaped string, with or without quotes.
- Read the decoded text in the output pane.
- Turn on “Show invisible characters” to see tabs and hidden spaces.
- Copy or download the text.
JavaScript Unescape String features
Every escape
\n, \r, \t, \b, \f, \v, \0, \xNN, \uXXXX, \u{…} and line continuations.
Quote-aware
Removes matching outer quotes and checks for unescaped quotes inside.
Emoji and surrogates
Surrogate pairs and code point escapes become real characters.
Strict errors
Reports malformed escapes and legacy octal with the character position.
Invisible characters
Optionally marks tabs, non-breaking and zero-width spaces.
Local
Decoding happens in your browser.
When to use JavaScript Unescape String
- Reading a multi-line message that a log printed with \n escapes.
- Recovering text from a minified JavaScript bundle.
- Checking what a \u-escaped string from an API actually says.
- Finding hidden zero-width characters in copied strings.
JavaScript Unescape String FAQ
Do I need to include the quotes?
No. If the text starts and ends with the same quote character, the quotes are removed; otherwise the whole input is decoded as the inside of a string.
What is the difference between \u00e9 and \u{e9}?
Both mean é. The four-digit form covers characters up to U+FFFF; the braces form, added in ES2015, accepts any code point, including emoji such as \u{1F600}.
Why is \07 an error?
Octal escapes are a legacy feature that is not allowed in strict-mode JavaScript or template literals. Use \x07 or \u0007 instead.
Can it decode template literals with ${…}?
Only if they contain no expressions. An expression needs to be evaluated, which this tool deliberately never does.
Does this decode URL encoding like %20?
No. Percent-encoding is a URL format; use the URL Decoder for that.
Does this work for JSON strings?
Yes. JSON string escapes are a subset of JavaScript’s, so they decode the same way.
Reading escaped strings
Escape sequences let a string literal contain characters that would otherwise be impossible or confusing to type: line breaks, tabs, quotes and characters from any script in the world. In source code they are a convenience, but when the same strings show up in logs, minified bundles, API responses or error messages, they make the text hard to read. Decoding them reveals the actual content.
JavaScript supports several families of escapes. Single-character escapes such as \n, \t and \ cover common control characters. \xNN gives a character by its two-digit hexadecimal code, \uXXXX by its four-digit UTF-16 code unit, and \u{…} by its full Unicode code point. Emoji and other characters outside the Basic Multilingual Plane appear either as a \u{…} escape or as two \uXXXX surrogates, and both decode to the same character.
The decoder follows the language rules strictly. A backslash before an ordinary character simply yields that character, a backslash at the end of a line continues the string on the next line, and malformed sequences such as \x4 or \u12 are reported with their position instead of being guessed at. Legacy octal escapes, which modern JavaScript forbids, are flagged too.
Decoded text can contain characters that are hard to see: tabs, non-breaking spaces, zero-width spaces and byte-order marks. They are a frequent cause of failed comparisons and odd formatting. The “Show invisible characters” option replaces them with visible markers so you can spot and remove them.
Everything runs in your browser, and nothing is evaluated: the tool reads escape sequences with its own decoder rather than handing the string to the JavaScript engine, so pasting text from untrusted sources is safe.