How to use String Escape and Unescape Tool
- Choose the target string context and Escape or Unescape. The JSON string and Literal pattern buttons choose their named escape mode.
- Paste literal text for escaping, or one complete representation in the selected grammar for unescaping. JavaScript mode accepts only the documented JSON-compatible double-quoted subset.
- Check quotes, backslashes and line breaks, then copy the result or download formatted-string.txt. Switching grammar changes how the value is represented.
Example: String Escape and Unescape Tool
Quote an apostrophe and double quotes as one POSIX shell word, without running a command.
Options
- JSON and JavaScript strings
- Both use one complete double-quoted JSON-compatible literal. JavaScript single quotes, template literals, \x and \v escapes are outside this subset.
- SQL, shell and CSV forms
- SQL-standard strings double internal apostrophes; CSV fields double internal double quotes. POSIX shell mode quotes one word and represents an internal apostrophe with its exact supported quote sequence. These formats do not validate a surrounding query, command or spreadsheet formula.
- Literal regex text
- Regex mode escapes text so its metacharacters can be matched literally. Unescape accepts that supported literal-text representation, not an arbitrary regex expression. The page does not run a pattern.
Supported inputs and limits
- Escape accepts up to 50,000 raw characters;
- Unescape accepts up to 300,002 formatted characters and returns at most 50,000.
- NUL is refused in every mode.
- Contexts are JSON strings, a JSON-compatible JavaScript double-quoted subset, standard SQL single-quoted literals, POSIX shell words, CSV fields and JavaScript regular-expression literal text.
- Only the selected documented grammar is accepted.
More details
No query or command is executed and no pattern is matched.
SQL quoting is not a substitute for parameters; shell word quoting does not validate a surrounding command;
CSV quoting alone does not neutralise spreadsheet formulas.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
A quoted value has a boundary
The surrounding quotes and the characters inside them work together. A backslash copied from one context can have another meaning in a different grammar. Use a round trip to inspect the intended literal text, and keep parsing or execution outside this conversion page.
Questions about String Escape and Unescape Tool
Why do SQL and JavaScript quotes look different?
They follow different string grammars. The SQL mode uses the documented standard single-quoted literal form; JavaScript and JSON have their own escape rules.
Does shell quoting make a whole command safe?
It quotes one supported shell word. It does not validate a command, its arguments or the program being called. Do not treat a recovered value as something this page has approved to execute.
Can I use this instead of query parameters?
SQL literal quoting is useful for inspecting text, but application database queries should use their parameter interface. A quoted string does not validate the surrounding query.
Why is an escape sequence rejected?
JavaScript mode accepts a JSON-compatible double-quoted subset, so forms such as single quotes, \x escapes or \v are refused. Other modes also require their named quoted form; check the selected context before unescaping.
Does quoting a CSV field neutralise a formula?
CSV mode quotes separators, quotes and line breaks. Spreadsheet apps may still treat a formula-leading cell as a formula. Use a data-only import or an explicit formula-safe export when that distinction matters.