Escape text for JSON, HTML, SQL…
- Free
- No sign-up
- No upload
- Works offline
Tool facts
- Price
- Free, no sign-up, no watermark
- Are files uploaded?
- No. Everything is processed in this browser, on your device.
- Offline use
- Works without a connection once this page has loaded
- Browser
- A recent Chrome, Edge, Firefox or Safari, on computer or phone.
Check it yourself: press F12, open the Network tab, then use the tool. No request carries your data.
About String Escape
String Escape converts text into a form that can be safely placed inside a JSON string, a JavaScript string literal, HTML or XML markup, a URL query parameter, a CSV field, an SQL string or a regular expression, and turns escaped text back into the original. Pick the format and the direction, and the result updates as you type, ready to copy into your code or data file.
Each format follows its own rules: JSON escapes quotes, backslashes and control characters as \n or \u0000; JavaScript also escapes single quotes, backticks and ${ for template literals; HTML and XML replace & < > " and ' with entities; URL uses percent-encoding of UTF-8 bytes; CSV wraps fields in double quotes and doubles inner quotes as RFC 4180 requires; SQL doubles single quotes; and regex escaping backslashes every metacharacter. Conversion is done locally in your browser.
String Escape runs entirely in your browser. Your data is processed on your device and is never uploaded to Qiyi or anyone else.
How to use String Escape
- Paste your text into the Input box.
- Choose the Format: JSON, JavaScript, HTML, XML, URL, CSV, SQL or Regular expression.
- Choose Escape or Unescape under Direction and set the extra options shown for that format.
- Copy the Output, or click Swap to feed it back in and reverse the direction.
Frequently asked questions
What is the difference between escaping and encoding?
Escaping marks special characters so a parser reads them as text rather than syntax, for example \" inside a JSON string or < inside HTML. Encoding converts characters into another representation, such as percent-encoding in URLs. This tool calls both escaping, because the goal is the same: embed arbitrary text safely.
Does SQL escaping protect against SQL injection?
Doubling single quotes produces a valid standard SQL string literal, which is useful for writing scripts and test data by hand. In application code you should always use parameterised queries or prepared statements instead, because they are safe regardless of database settings and character sets.
Why does URL escaping turn spaces into %20 and not +?
Percent-encoding (RFC 3986) represents a space as %20, which is valid everywhere in a URL. The + sign only means a space in HTML form data (application/x-www-form-urlencoded). Turn on Form encoding to use + for spaces and to decode + as a space.
How does HTML unescaping handle named entities?
HTML unescape uses the browser's own HTML parser, so all named entities such as , é and ♥, plus decimal and hex references, are decoded. XML unescape only decodes the five XML entities and numeric references, which is what XML parsers accept.
Why can't my JSON be unescaped?
The text must be a valid JSON string body: every backslash has to start a valid escape such as \n, \" or \u00e9. A lone backslash, a \x escape or an unescaped control character makes it invalid. If the text is JavaScript rather than JSON, choose the JavaScript format, which is more lenient.