JavaScript String Unescape

escaping-tools

How to use the JavaScript String Unescape

Decode JavaScript escape sequences in two steps:

1

Paste the escaped string

Paste the JavaScript-escaped string as it appears in code. Do not include the surrounding quote characters — paste only the string contents.

2

Read the decoded output

All recognized JavaScript escape sequences are decoded to their actual characters. Unrecognized sequences are passed through unchanged.


When to use this tool

Use this tool to decode JavaScript escape sequences back to readable text:

  • Decoding \n, \t, and \r escape sequences in JavaScript strings copied from source code or log output
  • Reading Unicode escape sequences (\uHHHH) found in JavaScript bundles, minified code, or obfuscated strings
  • Decoding \xHH hex escape sequences used in JavaScript for character encoding
  • Inspecting the actual content of JavaScript strings when debugging minified or obfuscated code
  • Converting JavaScript-escaped strings from API responses, database fields, or configuration files back to human-readable form
  • Verifying the output of JavaScript string escape tools by round-tripping escaped content back to the original

Frequently asked questions

Q:Do I need to include the surrounding quotes when pasting?
No — paste only the string content between the quotes, not the quotes themselves. If your source code has const msg = "Hello\nWorld"; then paste only Hello\nWorld (without the surrounding double quotes). Including surrounding quotes may cause them to appear in the output as literal characters since the decoder treats the input as string content rather than a complete string literal expression.
Q:What is the difference between \uHHHH and \u{HHHH} in JavaScript?
\uHHHH is the classic 4-digit Unicode escape supported since ES1 — it can only represent characters in the Basic Multilingual Plane (U+0000 to U+FFFF). Characters above U+FFFF (emoji, historic scripts) must be represented as a surrogate pair: two \uHHHH sequences. \u{HHHH} was introduced in ES6 (ES2015) and accepts 1–6 hex digits, directly representing any Unicode code point including supplementary characters. For example, the emoji 😀 (U+1F600) can be written as \uD83D\uDE00 (surrogate pair) or \u{1F600} (ES6). This decoder handles both forms.
Q:What happens to characters that are not escape sequences?
Any text that is not recognized as a JavaScript escape sequence is passed through to the output unchanged. This includes plain letters, numbers, punctuation, and already-decoded characters. Backslashes not followed by a recognized escape character (n, r, t, v, b, f, 0, u, x, \, ', ") are also left unchanged. This makes the decoder safe to run on partially-escaped strings or strings that mix regular text with escape sequences.
Q:Can this tool decode obfuscated JavaScript that uses \uHHHH for identifiers?
Yes — JavaScript allows any identifier or string to be written using Unicode escape sequences. Obfuscated code often encodes variable names and string content as \uHHHH sequences to prevent casual reading. Pasting the obfuscated string content into this decoder reveals the underlying characters. However, for fully obfuscated JavaScript files with variable renaming, control flow flattening, and other transformations beyond character encoding, a dedicated JavaScript deobfuscator like de4js or synchrony would be more appropriate.
Q:How does \xHH hex escape work in JavaScript strings?
The \xHH escape represents a single byte using two hexadecimal digits, where HH is a hex value from 00 to FF. It is equivalent to \u00HH — both produce the same character. For example, \x41 decodes to 'A' (ASCII 65), \x0A decodes to a newline (LF), and \xE9 decodes to 'é' (U+00E9, Latin Small Letter E with Acute). The \x escape is limited to characters in the Latin-1 range (U+0000 to U+00FF) — for characters beyond this range, \uHHHH or \u{HHHH} must be used.
Q:Why does my decoded string still show backslash sequences?
If decoded output still shows literal backslash sequences, the input may contain double-escaped sequences (escaped twice). For example, if the input contains \\n (a backslash followed by 'n'), the first decode converts \\n to \n, leaving the literal two-character sequence backslash-n rather than a newline. Run the result through the decoder a second time to remove the second layer of escaping. This happens when strings are serialized twice — for example, a JavaScript string stored in a JSON field, where each layer of escaping is additive.