Skip to main content
Programming Language Tools

JS Escape/Unescape

Escape a string for safe use inside JavaScript source, or unescape an already-escaped string back to plain text.

Paste text to escape it for safe use inside a JavaScript string, or paste an already-escaped string to unescape it back to plain text.

Common characters this handles: quotes, backslashes, newlines, tabs, and Unicode characters outside the basic ASCII range.

What Is String Escaping?

Escaping replaces special characters (like quotes, backslashes, or newlines) with a backslash-prefixed sequence so they can be safely embedded inside a JavaScript string literal without breaking the surrounding code's syntax.

Why Use This Tool?

Manually escaping a multi-line string or one containing quotes is tedious and error-prone - a single missed backslash breaks the entire script. This tool does it correctly and instantly, in both directions.

How to Use It

  1. Paste text into either box.
  2. Click Escape to convert plain text into a JS-safe escaped string, or Unescape to convert an escaped string back to plain text.
  3. Copy the result.

Limitations

This handles standard JavaScript string escape sequences - it does not evaluate or execute the string as code.

Share this tool: