String Escape & Unescape - JSON, JavaScript, Python, SQL, Regex, Shell, CSV

AdSense Placeholder
Slot: header_tool

String Escape & Unescape

Safely turn text into a string literal for seven formats, and back

AdSense Placeholder
Slot: tool_mid_article

Seven Formats

JSON, JavaScript, Python, SQL, regular expressions, POSIX shell and CSV, each following its own rules.

Both Directions

Escape text to embed it in code, or unescape a string you found in a log or source file. Swap turns the result into the next input.

Unicode Aware

Emoji and accented text survive intact, or can be written as \u escapes for ASCII-only output.

Full Privacy

Everything happens in your browser. Nothing you paste is uploaded.

Why Escaping Matters

A quote, backslash or newline inside a string can end it early or change its meaning. Escaping keeps the text as data. That prevents broken JSON, unterminated string literals, mangled CSV files and regular expressions that match the wrong thing.

Important: for SQL, escaping is not a defence against injection. Always use parameterised queries in real code. The SQL mode doubles single quotes, which is the standard-SQL rule; some databases such as MySQL can also treat backslashes specially, so check yours before pasting a result into a query.

Key Takeaways

  • Correct per format: Each mode follows that language's own escape rules, not a generic one.
  • Clear errors: A bad escape such as \x4 is reported instead of silently guessed.
  • Reversible: Escaping then unescaping returns your original text.
AdSense Placeholder
Slot: footer_leaderboard