String Escape & Unescape

Escape strings for JSON, JS, Python, SQL, CSV, regex, shell

How to escape a string

  1. Choose the target: JSON, JavaScript, Java/C#/C, Python, SQL, CSV, XML/HTML, a regular expression, a Bash shell argument or PHP.
  2. Paste the raw text and press Escape. Quotes, backslashes, newlines, tabs and control characters are converted to the correct escape sequences for that language, and the result can be wrapped in the right quotes.
  3. Press Unescape to go the other way, for example to read a JSON string full of \n and \", or a log line with \u00e9 sequences.

Escaping rules by language

Everything happens in your browser, so you can safely escape secrets, connection strings and private data.

Why does my JSON have \u characters?

Some encoders write non-ASCII characters as \uXXXX escapes. They are valid JSON; choose JSON and press Unescape to read them as normal text.

Is escaping enough to prevent SQL injection?

No. Escaping helps, but the reliable protection is prepared statements with bound parameters, which every database driver supports.

How do I escape a string for HTML attributes?

Choose XML / HTML. It escapes &, <, > and both quote characters, which is safe for text content and quoted attribute values.

Made by BufferMint. We also design and build software products for founders. See our services →

Your files and inputs never leave your device; we only count anonymous visits.