String Escape / Unescape

Escape newlines, quotes, and special characters for embedding text in JSON or JavaScript source, or unescape it back to plain text.

Copied
Input0 B
Output0 B

Escaping converts newlines, tabs, quotes, and backslashes into their \n, \t, \"-style escape sequences, producing a value that can be safely embedded as a single-line JSON or JavaScript string literal.

Frequently asked questions

How do I escape a string for JSON online?

Paste the raw text into the input box and click Escape. The result is quoted and escaped exactly as it would appear as a JSON string value.

Can I unescape a string that already has surrounding quotes?

Yes — both a quoted string like "line1\\nline2" and an unquoted escaped fragment are accepted by Unescape.

Related tools

← Back to all tools