Advertisements

headerup to 320x100 / 728x90

JavaScript Escape / Unescape

Escape or unescape JavaScript string literals with backslash, quote, Unicode, and control-character handling

Mode:
Input
Loading editor...
Output

Output will appear here...

Advertisements

content bottomup to 300x250

What is JavaScript Escape / Unescape

Last reviewed:

JavaScript is the programming language of the web, running in every modern browser and powering most interactive frontends and Node.js backends.

JavaScript Escape / Unescape turns arbitrary text into a safe string literal (escaping \, ", ', `, newlines, tabs, and control characters) or reverses the operation by interpreting \n, \t, \x, \u, and \u{...} sequences.

It is the go-to helper for embedding user input in generated JavaScript, debugging minified code, and sharing snippets between code reviews and documentation.

Why use it

  • Safely embed user-provided strings in generated JS code.
  • Round-trip copy-pasted snippets from minified bundles.
  • Decode \u escape sequences emitted by third-party APIs.
  • Avoid subtle bugs from unescaped backticks in template literals.
  • Teach escape-sequence semantics to new developers.

Features

  • Escapes \, ", ', `, newlines, tabs, control chars
  • Unescapes \x, \u, and \u{...} sequences
  • Safe for template literals
  • Zero-upload JavaScript pipeline, nothing touches a server
  • Handles astral-plane Unicode

How to use JavaScript Escape / Unescape

  1. Choose direction. Pick Escape or Unescape.
  2. Paste text or literal. Drop raw text or an escaped JavaScript literal.
  3. Run. Copy the escaped or unescaped result.

Example (before/after)

Raw text

He said "Hi" <3
Tab:	done

Escaped

He said \"Hi\" <3\nTab:\tdone

Common errors

Only single quotes escaped

Some tools miss backticks used in template literals.

Fix: This tool escapes ', ", and ` together to keep output safe for any literal type.

Unicode beyond BMP lost

Characters above U+FFFF need surrogate pairs.

Fix: Use \u{...} for emoji or astral code points.

FAQ

Does it escape single and double quotes?

Yes — both, plus backticks, to support template literals.

Which Unicode forms are supported?

\xNN, \uNNNN, and \u{H..H} for astral code points.

Does it handle backticks?

Yes. Backticks are escaped on output so the result is safe inside template literals.

Is my text uploaded?

No — escape / unescape runs entirely in your browser.

Will it change case?

No. Only escape sequences are added or removed.