JavaScript Escape & Unescape
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.
- Paste text or a literal.
- Press Encode or Decode.
- 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.
Related tools
JSON Escape & Unescape
Escape text into a valid JSON string literal or unescape an escaped JSON string.
HTML Escape & Unescape
Escape text for safe HTML output or decode HTML entities back to readable characters.
JavaScript Formatter
Beautify JavaScript with proper indentation, spacing and line breaks.
HTML Formatter
Beautify HTML with consistent indentation while keeping inline and void elements correct.
CSS Formatter
Beautify CSS with one property per line and consistent indentation.
HTML Minifier
Reduce HTML size by collapsing whitespace and removing unnecessary characters.