JavaScript Unescape — Decode JS Escape Sequences

Decode \n, \t, \u00xx, \xNN, and quote escapes back to their original characters. Read minified strings, log lines, and obfuscated literals — 100% in your browser.

What is a JavaScript Unescape Tool?

A JavaScript unescape tool reverses string-literal escape sequences. It converts \n back to a real newline, é to é, \xff to ÿ, and collapses \\ to a single backslash. It is the fastest way to read a string that was emitted by JSON.stringify, written into a JS source file, or extracted from a minified bundle.

JavaScript's string syntax has at least four escape forms — named (\n \t \r), hex (\xNN), four-digit Unicode (\u00xx), and ES6 code-point (\u{1F600}) — plus quote and backslash escapes. The OpenFormatter unescaper applies them in the correct order, in your browser, with no upload.

How to unescape JavaScript online — 4 steps

  1. Paste the escaped string. Drop the contents of a quoted or backtick string literal into the Input panel. Click Load Sample to try a demo with newlines, Unicode, hex, and quote escapes.
  2. Click Run. The unescaper applies ES6 code-point, Unicode, hex, named escapes, then quotes, and finally collapses double backslashes — all client-side.
  3. Read the decoded text. Real newlines wrap, tabs indent, and Unicode renders. The Output panel uses aria-live="polite" for screen-reader users.
  4. Copy the result. Click Copy to grab the decoded text for a terminal, log viewer, or your editor.

Sample escaped input vs decoded output

Escaped JS string

Hello,\n\tWorld!\nUnicode: \u00e9\u00f1\u00fc\nHex: \x41\x42\x43\nQuote: \"escaped\" and \'single\'\nBackslash: C:\\Users\\file.txt

Decoded output

Hello,
	World!
Unicode: éñü
Hex: ABC
Quote: "escaped" and 'single'
Backslash: C:\Users\file.txt

Every Escape Form

Named (\n \t \r \b \f \v \0), hex (\xNN), four-digit Unicode (\u00xx), ES6 code-point (\u{1F600}), quote (\' \" \`), and backslash (\\) — all decoded in the correct order.

Full Unicode Range

Both four-digit BMP escapes and ES6 \u{...} escapes up to U+10FFFF are supported, so emoji, rare CJK, and astral-plane characters round-trip perfectly.

Browser-Only

Decoding runs in JavaScript on your device. Logs containing tokens, customer data, or proprietary strings never leave the browser.

Common use cases

  • check_circleReading log lines that emitted \n and \t instead of real newlines and tabs
  • check_circleDecoding strings extracted from a minified webpack or esbuild bundle
  • check_circleInspecting obfuscated JavaScript that uses \xNN to hide string literals
  • check_circleRecovering original text from JSON.stringify output that has \u00xx Unicode escapes
  • check_circleDecoding error messages copied from a Node.js stack trace
  • check_circleRestoring file paths that contain \\ doubled backslashes (Windows JSON)
  • check_circleReading a string that round-tripped through a database column with escaping
  • check_circleExamining template literals captured from a tagged template tag function

JS unescape vs JSON unescape vs HTML unescape

All three reverse a different escape alphabet. JavaScript unescape reverses JS string literal escapes — \xNN, single-quote escape \', octal escapes (in legacy code), and the ES6 \u{} form. JSON unescape reverses only the limited RFC 8259 set — no \xNN, no single quotes, no \u{}. HTML unescape reverses entity references — <, ', '. Picking the wrong one leaves the literal escape in the output unchanged.

Need to escape instead of unescape?

Re-encode a string for embedding inside a JS literal, beautify a minified bundle, or browse the full escape toolkit.

Frequently Asked Questions

How are \u00xx sequences decoded?

A four-hex-digit \u escape addresses the Basic Multilingual Plane (U+0000 to U+FFFF). The unescaper parses the four hex characters with parseInt(h, 16) and emits the matching code point with String.fromCharCode. So \u00e9 becomes é, \u4e2d becomes 中, and \u00a0 becomes a non-breaking space.

Does it handle \xNN hex byte escapes?

Yes. The legacy \xNN form addresses the first 256 Latin-1 code points. \x41 decodes to A, \x7f to DEL, \xff to ÿ. Anything above \xff requires \u escapes — \xNN cannot represent it.

What is the difference between template literal and single-quoted string escapes?

Template literals (backtick) and quoted strings share the same escape table — \n, \t, \u00xx all work in both. The differences are: template literals additionally escape backtick (\`) and dollar-brace (\${), and they preserve real line breaks. This unescaper handles every escape that appears in either string form, including \` for template literals.

Does it support ES6 \u{...} extended code-point escapes?

Yes. The ES6 \u{1F600} form supports the full Unicode range up to U+10FFFF, including emoji and rare scripts that need a surrogate pair in the legacy four-digit form. The unescaper checks the longer pattern first so \u{1F600} is decoded as a single emoji rather than the literal characters.

Why is the backslash decoded last?

Order matters. If \\\\ were unescaped to \\ first, the next pass might re-interpret it as the escape character of an adjacent sequence. By decoding all named escapes (\n \t \u…), then quotes, then finally collapsing \\\\ to \\, every backslash that survived earlier passes is treated as a literal backslash exactly once.

Will this break valid Unicode characters in my input?

No. Only sequences that begin with a literal backslash are touched. Real emoji, accented letters, CJK characters, and any other Unicode pass through unchanged. Only patterns matching \n, \u00xx, \xNN, etc. are rewritten.

Is the input sent to your servers?

No. The unescaper runs entirely in your browser. Strings containing tokens, secrets, customer data, or proprietary code never leave your device. Open DevTools → Network and click Run to verify no requests are issued.

Is this the same as decodeURIComponent or unescape?

No. decodeURIComponent reverses URL percent-encoding (%20 → space). The legacy global unescape also handles percent-encoding and is deprecated. This tool reverses JavaScript string-literal escapes — the backslash sequences a JS source file uses to embed special characters in a string. Different alphabet, different operation.

JavaScript Unescape — Decode JS Escape Sequences