String Escape & Unescape

Escape and unescape strings for JSON, HTML, XML, URL, CSS, regex, shell, SQL, C/Java, and LaTeX contexts.

How to escape a string

  1. Choose the context: JSON, HTML, XML, URL, CSS, regex, shell (Bash), SQL, C/Java, or LaTeX.
  2. Choose Escape or Unescape.
  3. Paste your text. The result updates as you type.
  4. Copy it into your code, query, or document.

The right escaping for each language

Every language has its own special characters. A quote needs \" in JSON, '' in SQL, and " in HTML, while shell commands need careful single-quoting. Getting it wrong causes syntax errors, broken output, or security bugs like injection. This tool applies the correct rules for each context, so you can safely drop a multi-line string into a JSON value, a regex, or a shell command.

Frequently asked questions

Is this a substitute for parameterized queries?

No. Escaping is useful for writing one-off queries and test data, but application code should always use parameterized queries and the escaping built into your framework.

Is my text sent anywhere?

No. Conversion runs in your browser.

What about Base64 or URL encoding?

URL escaping is included here. For Base64, hex, Punycode, and other encodings, use the Encoding Converter. To test a pattern after escaping it, use the Regex Tester.

Related tools

More in Text & Code Tools · All 73 tools