JavaScript Escape
Escape text for use inside a JS/JSON string literal, live as you type, in either direction.
Escapes text the way it would appear inside a JS/JSON string literal (quotes, backslashes, newlines) — type in either field, both directions update live. Runs entirely in your browser.
What is JavaScript Escape?
Type text and see it escaped the way it would need to appear inside a JavaScript or JSON string literal (quotes, backslashes, and newlines escaped) — type in either field, both directions update live. Handy when hand-building a string literal that contains quotes, backslashes, or line breaks — pasting user-generated text into a JS template, a JSON payload, or a config file without it breaking the surrounding syntax. Everything runs in your browser as you type.
FAQ
Yes, under the hood — it produces the exact escaping JSON.stringify would, minus the surrounding quotes, so you can drop the result straight into your own string literal.
Yes — this tool works in both directions; type or paste into either field and the other updates instantly.