Escape/Unescape

Escape or unescape strings for different contexts. All in your browser.

Try it with this example

Type a string with quotes and backslashes. Choose JSON, HTML, or URL mode and escape or unescape.

What is this tool?

Strings often need escaping for JSON, HTML, URLs, or regex. Quotes, backslashes, and special characters can break parsing or enable injection. The Escape Unescape tool handles both directions: escape a string for safe use in JSON, HTML, a URL, or a regex pattern, or unescape it back to plain text. Choose the target context, paste your string, and get the escaped or unescaped result. Prevents XSS, malformed JSON, and broken queries.

For JSON, escaping means turning " into \", backslash into \\, and control chars into \n, \t, etc. For HTML, < becomes <, > becomes >, and & becomes &. For URLs, spaces become %20, and special chars get percent-encoding. For regex, [. * + ? ( ) { } | \] and similar get escaped so they're literal. Each context has different rules; the tool applies the right ones for the mode you select.

Unescaping reverses the process. Paste a JSON-escaped string and get the raw text. Paste percent-encoded URL data and get readable text. Use it when building JSON programmatically and need to safely include user input, when preparing strings for HTML display, or when debugging why a regex isn't matching—often an unescaped special character is the culprit.

All processing runs in your browser. No server, no stored data. The tool is for quick conversion; for production code, use your language's built-in escaping functions. This tool helps you verify expected output, test edge cases, or manually escape when you're not in code. Handy when wiring APIs, sanitizing output, or fixing encoding bugs.

Essential for safe string handling across contexts.