String Escaper / Unescaper

Escape and unescape strings for JSON, SQL, HTML/XML, JavaScript, Regex, and CSV
This free online string escaper / unescaper runs in your browser and is part of our Text Tools collection.

String Escaper / Unescaper

Safely escape and unescape strings for JSON, SQL queries, HTML/XML entities, JavaScript, Regular Expressions, CSV, and URLs.

Source Text: 0 chars
Escaped Output (JSON): Ready

Supported Escaping Types

  • JSON: Escapes double quotes (\"), backslashes (\\), and control characters (\n, \t).
  • SQL: Escapes single quotes to prevent syntax errors and injection ('' or \').
  • HTML: Encodes characters like &, <, >, ", and ' into HTML entities.
  • Regex: Safely escapes all special regex characters (. * + ? ^ $ { } ( ) | [ ] \) so text can be used as a literal match.
⚡
Instant In-Browser Execution Runs locally in JavaScript without wait times or server delays.
🔒
100% Privacy & Security Your inputs and files are never stored or logged on remote servers.
📱
Cross-Device Responsive Fully optimized for mobile smartphones, tablets, and desktop displays.
🎉
100% Free Forever No subscription fees, no signups, and no software installations.

How to Use the Online String Escaper / Unescaper

1 Select Target Language / Syntax

Choose your target format: JSON, SQL, HTML/XML Entities, JavaScript/TypeScript, Regular Expression, or CSV.

2 Select Mode (Escape or Unescape)

Choose "Escape" to add safe backslashes and entities, or "Unescape" to restore clean raw strings.

3 Paste Content

Enter the string containing quotes, backslashes, tabs, HTML tags, or special characters.

4 Convert & Copy Clean String

Click "Transform" to inspect the escaped output and copy it directly into your code, query, or payload.

Frequently Asked Questions

Common questions about using this free online string escaper / unescaper.

What does JSON escaping handle? ▾
JSON escaping converts double quotes to `\"`, backslashes to `\\`, newlines to `\n`, carriage returns to `\r`, and tabs to `\t`, guaranteeing valid RFC 8259 string payloads.
How does SQL escaping protect queries? ▾
SQL escaping doubles single quotation marks (`'` becomes `''`) and escapes control characters, preventing string literals from breaking out of database commands in legacy contexts.
What special characters are escaped for Regular Expressions? ▾
RegEx escaping places a backslash in front of all 14 regex metacharacters: `.` `^` `$` `*` `+` `?` `(` `)` `[` `]` `{` `}` `|` `\`, allowing literal string matching without syntax errors.
What is the difference between HTML escaping and URL encoding? ▾
HTML escaping replaces markup characters (`<`, `>`, `&`, `"`) with HTML entities (`&lt;`, `&gt;`, `&amp;`, `&quot;`) to prevent XSS. URL encoding uses percent-encoding (`%20`, `%2F`) for safe transmission in web addresses.

More Text Tools

Explore related tools in the same category to solve adjacent tasks faster.

Word CounterCount words, characters, and linesCase ConverterConvert text case (upper, lower, title, sentence)Lorem Ipsum GeneratorGenerate placeholder textText Diff CheckerCompare two texts and find differencesDuplicate Line RemoverRemove duplicate lines from text