String Escape / Unescape
Escape or unescape text for JavaScript, JSON, SQL, shell or CSV.
Examples
Questions
Are JavaScript and JSON escaping the same?
Here, yes. Every string JSON.stringify makes is also a valid JavaScript string.
How does shell escaping work?
The whole string is wrapped in single quotes. Inside single quotes, a POSIX shell keeps every character as it is except the single quote itself, which becomes '\''.
What does CSV escaping do?
As RFC 4180 says: a field is quoted only if it has a comma, a double quote or a line break. A double quote inside is doubled.
Why does unescaping sometimes fail?
JSON and JavaScript fail on a broken escape, such as a stray quote or an incomplete \u escape. Shell expects single-quoted input. SQL and CSV never fail.
Related tools
- JSON Formatter & ValidatorFormat, minify, check and repair JSON, with errors shown by line and column.
- SQL FormatterFormat SQL with consistent indentation and keyword case, for eight dialects.
- JSON to CSV ConverterConvert a JSON array to CSV, or CSV to JSON, with nested keys as columns.
- Regex TesterTest a regex against your text, with live highlights and a replace preview.
- Unicode Escape ConverterConvert text to \uXXXX Unicode escapes, or decode them back.