Useful Hacks

String Escape / Unescape Tool

Escape or unescape a string for JavaScript/JSON, SQL or CSV.

Processed locally in your browser. Nothing you enter is uploaded or stored.
  • Free — no signup, no account, no watermark
  • Runs entirely in your browser — nothing is uploaded to a server
  • Works on mobile, tablet and desktop
  • Instant — results appear as soon as you enter your input

Why this is private

  • Processed locally in your browser. Nothing you enter is uploaded or stored.
  • Open your browser's DevTools → Network tab while using this tool — you won't see a request carrying your input, because it never leaves your device.
  • Nothing you enter is uploaded to a server or shared with us — the processing happens entirely on your device.

Overview

Escapes or unescapes a string for safe inclusion in a JavaScript/JSON string literal, a SQL string literal, or a CSV field — three different escaping rules, one tool.

How to use it

  1. 1Pick what you're escaping for: JavaScript/JSON, SQL, or CSV.
  2. 2Choose Escape (raw text → safely-escaped form) or Unescape (escaped form → raw text).
  3. 3Paste your text — the result updates automatically.

Formula

JavaScript / JSON

Uses JSON.stringify, so \n \t \" \\ and Unicode escapes are produced exactly as a JS/JSON parser expects.

SQL

A literal ' is doubled to '' — the standard ANSI SQL string-literal escape, portable across MySQL, PostgreSQL, SQLite and SQL Server.

CSV

Per RFC 4180: a field containing a comma, quote or line break is wrapped in double quotes, with any internal " doubled to "".

Frequently asked questions

What people use it for

Embed a string with quotes in a JS template or JSON valueEscape a title or name containing apostrophes or quotes before hardcoding it.
Build a one-off SQL statement safelyEscape a value containing an apostrophe (e.g. "O'Brien") before dropping it into a query — though parameterized queries are safer for real applications.
Fix a CSV field with a comma or quote in itEscape a value like `Smith, John "Jr."` so it survives a CSV round-trip correctly.
Decode an escaped string from a log or configUnescape a `\n`/`\"`-laden string back to readable text.

Related guides

Related tools

All developer tools

Ready to use String Escape / Unescape Tool?

String Escape / Unescape Tool

Search tools

Search for any tool by name, category or keyword