How to use the String Escape / Unescape tool
Paste any string and pick a target — JSON, JavaScript/TypeScript, Java/C#/C/C++, Python, Go, POSIX shell, SQL, regex, HTML, or XML. The tool shows the escaped form (safe to paste as a string literal) and the unescaped form (decoded back to raw text) at the same time, so you never have to guess a direction. Everything runs locally in your browser; nothing is uploaded.
What it does
- Escapes quotes, backslashes, newlines, tabs, and control characters for each target's string syntax.
- Optionally escapes non-ASCII characters as
\uXXXX, \U........, or &#x;.
- Unescapes literals back to raw text, with a clear note when the input is malformed.
- Shows the escaped form for every target at once for quick comparison.
When to use it
- Pasting a value with quotes or newlines into source code or a config file.
- Building a SQL query string and needing to escape an apostrophe.
- Turning a literal phrase into a regex that matches it exactly.
- Encoding text for safe display in HTML, or decoding entity-encoded content.
- Reading an escaped blob from a log and wanting the original text back.
How to use it
- Paste your string into the input box.
- Choose the target language or format.
- Copy the Escaped or Unescaped result, or open the all-targets panel to compare.
Tips & pitfalls
- The shell output uses the single-quote form, which is the safest; a double-quoted context escapes a different set (
" \ $ `).
- SQL escaping here uses standard single-quote doubling; some databases also accept backslash escapes, but doubling is portable.
- Regex unescaping is best-effort: it removes one backslash before an escaped metacharacter to recover the literal text.
- Turn on "Escape non-ASCII" when a target or pipeline only accepts ASCII.
FAQ
- What does escaping a string mean? Escaping rewrites characters that have special meaning in a target syntax (such as quotes, backslashes, and newlines) so the string can be safely embedded as a literal in code, a query, or markup.
- How do I escape a single quote in SQL? In standard SQL you double the single quote, so O'Brien becomes O''Brien inside a string literal. Some databases like MySQL also allow a backslash escape, but doubling the quote is the portable form.
- Is my text uploaded anywhere? No. All escaping and unescaping run entirely in your browser. Nothing you paste is sent to any server.
Related guides