String Escape / Unescape
Make text safe to paste inside a string literal, query or file format, or turn escaped text from a log back into something readable.
Escapes " \ and control characters. Unescape accepts the contents with or without the surrounding quotes.
How to escape a string
- Choose the format and Escape or Unescape.
- Paste your text.
- Copy the result, or use Swap to reverse it.
Features
- 12 formats in both directions
- JSON, JS, Java/C#, Python string literals
- HTML entities, XML, URL, CSV, SQL, MySQL
- Regex literal escaping
- Unicode \uXXXX and \u{…}
- Emoji and Indian scripts handled correctly
Frequently asked questions
What is the difference between JSON and JavaScript escaping?
JSON only allows \" \\ \/ \b \f \n \r \t and \uXXXX. JavaScript also allows \' \xHH, \u{1F600} and \v, and lets you pick single, double or backtick quotes.
How are emoji escaped?
Formats that use \uXXXX write an emoji as two escapes (a surrogate pair), for example 😀 becomes \uD83D\uDE00. Python uses \U0001f600, and the Unicode mode can write \u{1F600}.
Is SQL escaping enough to stop SQL injection?
It helps when you must build a query by hand, but parameterised queries (prepared statements) are the safe way. Use this for one-off scripts and data fixes.
Why does unescaping fail?
Usually because of a lone backslash at the end, a broken escape such as \u12 with too few digits, or a % in a URL that is not followed by two hex digits. The error says where.
Is my data sent to a server?
No. Everything runs in your browser, so configs, API responses and code never leave your device.
Related tools
All Developer Tools →- HTML Entity Encoder Safely show code and special characters on a web page, or turn &-style entities back into readable text.
- URL Encode / Decode Make text safe for URLs and query strings, or read encoded URLs from logs and analytics.
- Base64 Encode / Decode Convert text to and from Base64, the encoding used in data URIs, emails, JWTs and basic authentication headers.
- JSON Formatter Pretty-print messy JSON, find syntax errors fast, or minify it for production.
- JSON to CSV Turn an array of JSON objects into a CSV you can open in Excel or Google Sheets.
- CSV to JSON Convert CSV or a range copied from Excel into a JSON array.