Escape raw text into a valid JavaScript string literal (\\n, \\t, quotes, control chars) or unescape a literal back to plain text. JS String Escaper is a free online tool from the ToolsRift JavaScript Tools collection. It runs entirely in your browser — nothing to install, no signup, and your data never leaves your device.
Loading JS String Escaper…
How to use JS String Escaper
Choose Escape or Unescape, paste your text, pick the quote character, then click Convert and copy the result.
Frequently asked questions
What does escaping do?
Escaping turns special characters — newlines, tabs, quotes, backslashes and control characters — into their JavaScript escape sequences so the text can be safely pasted inside a string literal.
Is the conversion reversible?
Yes. Unescaping decodes \n, \t, \r, \b, \f, \v, \0, \xXX, \uXXXX and \u{...} back to the original characters, so escape then unescape returns your exact input.
Which quote should I pick?
Pick the quote you will wrap the string in. The escaper escapes only that quote character, leaving the other quote untouched for cleaner output.
ToolsRift processes your files in your browser. We use cookies only for basic analytics and to support ads that keep every tool free. See our Cookie Policy.