Back to Tools
JS Escape / Unescape
JS Escape / Unescape
Safely escape or unescape special characters for JavaScript strings
JS PRO
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
- Paste your code into the input box, or click Sample to load an example.
- Choose the Action: Escape or Unescape.
- Choose the Encoding Type: standard (\n, \t, \"), hexadecimal (\xHH) or Unicode (\uHHHH).
- Press Transform String.
- 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.