String Escape

Escape strings for a specific target language

Runs in your browserUtility05Text & Diff

What is String Escape?

A string escaping tool applies the quoting rules of Java/C#, JavaScript, Python, SQL, Shell, or CSV — handling quotes, backslashes, and newlines — and reverses the process just as easily. Use it to drop a chunk of text full of special characters safely into source code. Everything runs locally in your browser.

How to use String Escape

  1. 1Choose the target language and the direction, escape or unescape.
  2. 2Paste your text; the result updates as you type.
  3. 3When pasting the result into code, make sure the surrounding quote character matches the style you selected.

Frequently asked questions

Why does the Shell output wrap everything in single quotes?+

Inside single quotes a POSIX shell treats every character literally except the single quote itself, which makes it the least error-prone escaping strategy there is. An embedded single quote has to close the string, append an escaped quote, and reopen it — that is the '"'"' sequence you see in the output.

Does SQL escaping protect against injection?+

Doubling single quotes makes the statement syntactically valid, but you are still assembling SQL by concatenating strings. Real protection comes from parameterized queries, where the driver sends the value as a bound parameter instead of splicing it into the SQL text. Use the SQL mode here only for one-off scripts.

Related tools

All tools