Home
Tom Utilities

JavaScript Escape & Unescape

HTML, CSS & JavaScript

Escape text into a safe JavaScript string literal or decode an escaped string.

Input

Result

How to use

Escaping JavaScript strings

Encode escapes quotes, backslashes and control characters. Decode reverses the process.

  1. Paste text or a literal.
  2. Press Encode or Decode.
  3. Copy the result.

Frequently asked questions

Which quote style is used?

Single quotes are used by default and inner quotes are escaped accordingly.

Does it handle unicode?

Yes, non ASCII characters are preserved or escaped using unicode escape sequences.