Back to Tools

JS Escape / Unescape

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 it contains quotes, backslashes or line breaks that would otherwise end the string early.
Live Support
We usually reply within minutes

Enter your name to start a conversation with our team.