String Escape & Unescape

Escape text for JSON, JavaScript, HTML or SQL.

Free. Runs in your browser: nothing you enter or open is uploaded.

How to use it

  1. Choose Escape or Unescape, then the format: JSON, JavaScript, HTML, XML, SQL, CSV, regex or URL.
  2. Paste your text. The result updates as you type.
  3. Copy the result, or press Swap to send it back to the input.

Questions

What does escaping a string mean?

Some characters have a special meaning in a format, such as a quote that ends a string or a less than sign that starts an HTML tag. Escaping writes them in a safe form so they are read as plain text.

Does escaping SQL quotes stop SQL injection?

Doubling single quotes helps when you build a one-off query by hand, but it is not a defence for an application. Use parameterised queries or prepared statements in code.

When does a CSV field need quotes?

When it contains the delimiter, a double quote, a line break, or starts or ends with a space. The field is wrapped in double quotes and any double quote inside is written twice.

What is the difference between JSON and JavaScript escaping?

JSON only allows double quoted strings and a fixed set of escapes. JavaScript also escapes single quotes and backticks so the text is safe inside any kind of JavaScript string.