Skip to content
Tools

String Escaper & Unescaper

Escape and unescape strings for JSON, SQL, regex, shell and more.

Local
Output

What this tool does

This tool escapes a string so you can paste it straight into code or a query, and unescapes it back to its readable form. Pick the direction with the mode and the syntax with the target.

Targets

  • JSON / JavaScript / Java: escapes quotes, backslashes and control characters, so the text is a valid string literal.
  • SQL: doubles single quotes for a quoted literal.
  • Regex: escapes the characters that have special meaning, so the text matches literally.
  • Shell: safe single-quoting, including the awkward quote-inside-quotes case.
  • CSV: quotes the field and doubles inner quotes when it contains a comma, quote or newline.
  • XML / HTML: escapes the five markup characters.

Why testers reach for it

Test code is full of embedded strings: a JSON body, a SQL fixture, a regex assertion, a shell argument. Escaping by hand is error-prone, and one missed backslash breaks the test. Paste the raw value, pick the target, and drop the result in.

Common use cases

  • Turning a sample payload into a JSON or JavaScript string literal.
  • Making a regex match a literal string that contains dots or brackets.
  • Quoting a value safely for a shell command in a CI step.

Frequently asked questions

Which syntaxes does it support?
JSON, JavaScript, Java/C#, SQL, regex, shell (single-quoted), CSV and XML/HTML. Pick the target that matches where the string is going.
Can it reverse the escaping?
Yes. Switch the mode to Unescape to turn an escaped literal back into its plain value.

Learning resources

Testsmith also runs hands-on courses and a free practice app for the skills behind this tool.

Feedback welcome

Found a bug in this tool, or want it to do something it does not? Tell us and we will take a look.