Skip to content

JavaScript Developer Suite · free · no sign-up

JS Escape / Unescape

Escape special characters in a string for use in JavaScript, or turn escape sequences back into plain text.

How it works Report a problem

JS Escape / Unescape

Safely escape or unescape special characters for JavaScript strings

JS PRO
Input String / Code
Transformed Output

                

About the JS Escape / Unescape

Escape special characters in a string for use in JavaScript, or turn escape sequences back into plain text.

How to use the JS Escape / Unescape

  1. Paste your code into the input box, or click Sample to load an example.
  2. Choose the Action: Escape or Unescape.
  3. Choose the Encoding Type: standard (\n, \t, \"), hexadecimal (\xHH) or Unicode (\uHHHH).
  4. Press Transform String.
  5. Use Copy (or Download where shown) to keep the result. Clear empties the box.

Worked example

A tab character becomes \t and a double quote becomes \" when escaped.

Tips

  • Escaping prevents quotes and line breaks from breaking a string literal.

Frequently asked questions

When do I need to escape a string?
When it contains quotes, backslashes or line breaks that would otherwise end the string early.