Escape and Unescape Strings: JSON, JS, SQL, Shell, Regex
Escape text for JSON, JavaScript, SQL or regex, and back.
Text put inside a string in code must have some characters written another way, or the code breaks (or worse, runs what was in the text). JSON and JavaScript write a backslash before quotes and control characters; SQL doubles a quote; a shell command takes the text in single quotes; a regular expression needs a backslash before each sign with a meaning. Unescape reads them back, taking the quotes off. Pasted code often holds keys and data, so it stays on your device.
How to use Escape strings
- Choose the Language: JSON, JavaScript, SQL, Shell or Regex.
- Choose Escape or Unescape, and paste the text.
- Press Copy result, or Download it as a text file.
Escape strings: common questions
Is it safe to paste code with keys into a string escape tool?
With this string escaper it is: escaping and unescaping happen in your browser, on your device, and the text is never sent anywhere. Keys and data in pasted code stay with you.
How do you escape a single quote in SQL and in a shell command?
For SQL the string escaper doubles each single quote, which every database reads. For sh, bash and zsh it puts the text in single quotes and writes a quote inside as '\''. Values from people still belong in query parameters.
Can the string unescaper read JavaScript \u escapes with braces?
Yes. Unescape for JavaScript reads every escape the language has, \x and \u with or without braces too, and takes off the quotes round the text. A sequence it cannot read is reported with its position.
Everything stays on your device. Nothing is uploaded. Works offline once your first visit has stored the app.