Escape / Unescape
11 free tools · 100% client-side
Escape and unescape strings for HTML, XML, JavaScript, Java, .NET, JSON, CSV, and SQL — instantly and privately in your browser.
Start here
Most-used Escape / Unescape
SQL Escape
Three escaping styles for SQL string literals — ANSI quote doubling, MySQL backslashes, or LIKE-pattern wildcards — and back again.
JavaScript Escape
Make any text safe inside a JavaScript string literal — quotes, backslashes, newlines and control characters handled both ways.
.NET Escape
C#-ready string literals from any text — standard escapes plus \uXXXX Unicode, decoded back just as easily.
All 11 Escape / Unescape
HTML Escape
Convert text to safe HTML entities and back — <, >, & and quotes handled, named and numeric entities decoded.
XML Escape
The five XML entities, handled both directions — make any text safe inside elements and attributes.
JavaScript Escape
Make any text safe inside a JavaScript string literal — quotes, backslashes, newlines and control characters handled both ways.
Java Escape
Java-ready string literals from any text — full \uXXXX Unicode escaping for clean, ASCII-safe source files.
.NET Escape
C#-ready string literals from any text — standard escapes plus \uXXXX Unicode, decoded back just as easily.
JSON Escape
RFC 8259 string escaping both ways — make any text safe inside a JSON string, or decode the backslash soup back to text.
CSV Escape
RFC 4180 field escaping — values with commas, quotes, or line breaks wrapped and doubled correctly, and unwrapped just as cleanly.
SQL Escape
Three escaping styles for SQL string literals — ANSI quote doubling, MySQL backslashes, or LIKE-pattern wildcards — and back again.
Python Escape
Turn any text into a Python string literal body — plain UTF-8, ASCII-only with \u/\U escapes, or a bytes literal — and decode repr() output back.
Regex Escape
Turn any literal text into a safe regex fragment — five flavors, so the escaping matches the engine that will actually compile the pattern.
Shell Escape
Wrap a string the way a POSIX shell or PowerShell actually needs it quoted — including the output's own quotes, ready to paste into a command line.
Learn more
The right escaping for the right context
Escaping bugs are context bugs: HTML entities inside a JavaScript string, SQL quoting applied to JSON, CSV fields that break on an unquoted comma. Each tool here implements one context's exact rules — HTML/XML entity encoding, JavaScript and Java string literals, .NET verbatim strings, JSON's backslash escapes, CSV's quote-doubling, SQL's single-quote doubling — with both escape and unescape directions, so a string can be safely embedded or recovered without consulting a spec.
Every page round-trips: escape, then unescape, returns the original byte-for-byte, including Unicode beyond the ASCII range. That property is the test these tools are built against, and it's why copying a result into source code or a data file just works.
Escaping is encoding, not security
A word of honesty that competitor pages skip: escaping makes text safe to embed in a syntax, not safe in the security sense. SQL escaping prevents a quote from terminating a literal — parameterized queries are still the real injection defense; HTML escaping prevents markup interpretation — a CSP and framework auto-escaping are still your XSS strategy. Use these tools for correctness in fixtures, logs, config files, and migrations, and keep the security mechanisms in your stack.
Which escape scheme do I need?
The escape tools split into a few real syntactic families, not eleven unrelated pages. HTML and XML share entity encoding — the same handful of special characters turned into named-entity sequences — differing mainly in which named entities each markup language recognizes. JavaScript, Java, .NET and Python share C-style string-literal escaping — backslash sequences for quotes and control characters, plus Unicode escapes for Java, .NET and Python's ASCII-only mode — differing mainly in which characters get that Unicode treatment and, for Python, whether it uses a surrogate pair or a single \U escape for characters above the Basic Multilingual Plane. JSON escaping is its own strict subset of that grammar, defined by RFC 8259 rather than a compiler. Regex escaping is a family of its own — it hides metacharacters from a PATTERN COMPILER, not from a string parser, so its character set (dots, parentheses, brackets) has nothing to do with the C-style family. CSV escaping and shell quoting are both wrapping mechanisms rather than backslash schemes — CSV wraps a field in quotes and doubles inner quotes, POSIX shells wrap a whole word in single quotes and splice out any embedded one — and SQL escaping is simpler still: doubling the single quote that delimits a string literal. Picking the right tool is really picking the right family, then the right member of it.
| Tool | Input | Output | Best for |
|---|---|---|---|
| HTML Escape | Plain text | HTML entities (< & " …) | Embedding text safely in a web page |
| XML Escape | Plain text | The five predefined XML entities | Embedding text in an XML document or SOAP message |
| JavaScript Escape | Plain text | A JavaScript string-literal body | Building a double-quoted JS string by hand |
| Java Escape | Plain text | A Java string-literal body with \uXXXX Unicode | ASCII-safe Java source and .properties files |
| .NET Escape | Plain text | A C# / .NET string-literal body | C# and F# source (not VB.NET's own grammar) |
| Python Escape | Plain text | A Python str/bytes literal body | Python source — str, ASCII-only or bytes styles |
| JSON Escape | Plain text | A JSON string body (RFC 8259) | Embedding text in a JSON field by hand |
| Regex Escape | Plain text | A regex pattern fragment (5 flavors) | Matching a literal string inside a larger pattern |
| CSV Escape | A field value | A quoted, doubled-quote CSV field | Building a CSV row by hand |
| SQL Escape | Plain text | A SQL string literal (quotes doubled) | Hand-written SQL scripts, fixtures, and migrations |
| Shell Escape | Plain text | A quoted shell word (bash/sh or PowerShell) | Pasting a value safely into a command line |
Help
Frequently asked questions
Everything you need to know about the Escape / Unescape.
01Which escape tool do I need?
Match the destination: embedding in a web page → HTML Escape; an XML document → XML Escape; a string literal in code → the JavaScript, Java, .NET or Python escape; a JSON value → JSON Escape; a pattern-matching engine → Regex Escape; a spreadsheet field → CSV Escape; a SQL string literal → SQL Escape; a command-line argument → Shell Escape. The tool name is the context the output is safe for.
02What's the difference between escaping and encoding?
Escaping marks special characters so a parser treats them as data within a syntax (& becomes & in HTML). Encoding transforms an entire payload into a different representation (Base64, URL percent-encoding). If the output must remain readable text in the same language, you want escaping; if it must survive transport, you want the encoding tools.
03Why does unescaping my string produce weird characters?
Usually double-escaping: the input was escaped twice (\\n instead of \n, &amp; instead of &), so one unescape pass reveals the intermediate form. Run unescape again — and fix the producer, which is double-encoding somewhere upstream.
Learn the format
Guides for escape / unescape
Escaping vs Parameterised Queries
Why escaping quotes does not stop SQL injection: numeric contexts, LIKE, identifiers, second-order attacks, and how prepared statements close the hole.
8 min readGuide · Web & APIsHTML Entities Explained: When to Escape &, <, > and Quotes
Which characters to escape in HTML text, attributes, URLs and scripts, how named, decimal and hex references differ, and why you keep seeing &amp;.
9 min readGuide · Developer ToolsFreeFormatter Alternatives (2026): Where Its Tools Went
FreeFormatter.com has been retired and its tool pages now return 404. A verified map of where each formatter, validator, escaper and encoder moved.
6 min readGuide · Developer ToolsHow to Escape a Single Quote in SQL
How to escape a single quote in SQL: the ANSI doubling rule, MySQL backslashes, Postgres dollar quoting, Oracle q-strings, LIKE patterns and binding.
9 min readGuide · Data FormatsXML Namespaces Explained: Prefixes, Default Namespaces and Common Errors
What xmlns and xmlns:prefix do, how default namespaces scope and inherit, why attributes are excluded, and why XPath returns nothing on namespaced XML.
7 min readTutorial · Data FormatsHow to Convert CSV to JSON in JavaScript, Python and the Browser
Tested CSV to JSON code for Node (papaparse) and Python (csv.DictReader), plus type inference, nested output, streaming, and the trip back to CSV.
7 min read