String Escape

Convert a text into an escaped string (\n, \", \\) ready to embed in code, and back.

What string escaping is

When embedding text inside source code (like a JSON string or a JavaScript variable), special characters such as line breaks, quotes and backslash need to be "escaped" — represented as a sequence like \n (line break), \" (quote) or \\ (backslash) — so the text is parsed correctly.

When to use it

Useful when building a JSON payload by hand, embedding multi-line text on a single code line, or debugging a string that came with escape characters and you want to read the original text.

Frequently asked questions

Does the escaped result include the outer quotes?

Yes — the result is a valid JSON string, including the double quotes at the start and end, ready to paste into code.

Does this work the same for JSON and JavaScript?

Yes, the escaping rules used here (based on JSON) are compatible with JavaScript strings.