String Escape / Unescape

Make text safe to paste inside a string literal, query or file format, or turn escaped text from a log back into something readable.

Runs in your browser. Nothing is uploaded Free, no sign-up Works on mobile
Format
Direction

Escapes " \ and control characters. Unescape accepts the contents with or without the surrounding quotes.

80 characters
87 characters

How to escape a string

  1. Choose the format and Escape or Unescape.
  2. Paste your text.
  3. Copy the result, or use Swap to reverse it.

Features

  • 12 formats in both directions
  • JSON, JS, Java/C#, Python string literals
  • HTML entities, XML, URL, CSV, SQL, MySQL
  • Regex literal escaping
  • Unicode \uXXXX and \u{…}
  • Emoji and Indian scripts handled correctly

Frequently asked questions

What is the difference between JSON and JavaScript escaping?

JSON only allows \" \\ \/ \b \f \n \r \t and \uXXXX. JavaScript also allows \' \xHH, \u{1F600} and \v, and lets you pick single, double or backtick quotes.

How are emoji escaped?

Formats that use \uXXXX write an emoji as two escapes (a surrogate pair), for example 😀 becomes \uD83D\uDE00. Python uses \U0001f600, and the Unicode mode can write \u{1F600}.

Is SQL escaping enough to stop SQL injection?

It helps when you must build a query by hand, but parameterised queries (prepared statements) are the safe way. Use this for one-off scripts and data fixes.

Why does unescaping fail?

Usually because of a lone backslash at the end, a broken escape such as \u12 with too few digits, or a % in a URL that is not followed by two hex digits. The error says where.

Is my data sent to a server?

No. Everything runs in your browser, so configs, API responses and code never leave your device.

Related tools

All Developer Tools →