Escaping runs entirely in your browser — nothing is uploaded.
Escape and unescape JavaScript strings online, free. JavaScript string escaping makes text safe to drop into any JS string literal — single-quoted, double-quoted, or a template literal — by escaping the backslash, the quote characters, and whitespace controls. This tool escapes text for source code or reverses it, entirely in your browser.
It escapes all three quote styles (' " `) plus ${ and the backslash, so the result is valid in any JavaScript string literal. 100% free, no registration, and complete privacy — everything runs locally in your browser, so your data never touches a server.
Escapes ', " and the backtick ` (plus ${ in template literals) so the string is safe in any context.
Turn raw text into a JS string literal body, or decode \n, \', \\ back to characters.
Runs locally with no upload — safe for config and keys you paste into source.
Your code and strings never leave your device.
Inside a single-quoted string escape ' as \'; inside a double-quoted string escape " as \"; inside a template literal escape the backtick ` as \` and ${ as \${. This tool escapes all quote styles plus the backslash so the result is safe in any JS string literal.
The backslash itself (\\), the three quote characters (' " `), and the whitespace controls newline (\n), carriage return (\r) and tab (\t). Backslash must be escaped first, otherwise it would corrupt the following escape sequences.
They overlap but differ. JSON only allows double-quoted strings and a fixed set of escapes; JavaScript also has single quotes, template-literal backticks and ${} interpolation. Use JavaScript Escape for code you paste into a .js file, and JSON Escape for values going into a .json document.
No. Escaping and unescaping happen entirely in your browser with plain JavaScript — no upload, no logging. Safe for embedding API keys or config strings into source.
Yes. Click Unescape and the tool reverses the literal escapes — \n becomes a real newline, \' becomes ', and \\ becomes a single backslash — recovering the original text.
We use cookies for analytics and personalized ads to help keep these tools free. Until you accept, ads stay non-personalized and analytics cookies are off. See our Privacy Policy.