String Escape / Unescape
Paste a string, pick a target language or format (JSON, JS/TS, Java/C#/C/C++, Python, Go, POSIX shell, SQL, regex, HTML, XML) and a direction. Escape makes it safe to paste as a string literal; Unescape decodes a literal back to raw text. The All-targets tab shows the result for every target at once. Runs in your browser; nothing is uploaded.
Auto-runs as you type. Ctrl+Enter to re-run.
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 — and a direction. The Escape direction produces a form safe to paste as a string literal; Unescape decodes a literal back to raw text. The All-targets tab shows the result for every target at once, so you can compare quickly. 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 result for every target at once in the All-targets tab 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 and the direction (Escape or Unescape).
- Copy the result, or open the All targets tab to compare every target.
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.