# String Escape & Unescape: JSON, JS, Java, Python, SQL, Bash

> Escape or unescape strings for JSON, JavaScript, Java, C#, C, Go, Python, SQL, bash, regex, CSV, XML and URL, with every changed character highlighted.

- URL: https://qilingtools.com/en/string-escape
- Category: Developer Tools (https://qilingtools.com/en/dev)
- Tags: [Text](https://qilingtools.com/en/tags/text), [Developer](https://qilingtools.com/en/tags/dev), [Code Formatting](https://qilingtools.com/en/tags/format), [Encoding](https://qilingtools.com/en/tags/encode)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

Quotes, backslashes, line breaks and special characters are what usually break when you paste text into code, config files or commands. Pick the target language, type the raw text and get a result you can paste straight in — or go the other way and turn an escaped string from a log or network capture back into plain text. Supported formats are JSON (RFC 8259), JavaScript single-quoted, double-quoted and template literals (backticks and ${ escaped, U+2028/2029 handled), Java, C#, C/C++ (octal control characters, UTF-8 byte escapes, no trigraphs), Go, Python, standard SQL quotes, SQL LIKE wildcards, bash-safe single quoting, regex metacharacters, CSV fields, XML / HTML attributes and URL encoding. Options escape non-ASCII characters such as accents, CJK and emoji as \u sequences, wrap the output in quotes, or treat each line as its own string. Unescaping strips surrounding quotes automatically, understands \x, \u, \U, \u{…} and octal forms, and warns about escapes the language does not recognise. The change view highlights every replaced character, with the before and after shown on hover.

## How to use

1. Choose Escape or Unescape and the target language or format
2. Type or paste text and toggle non-ASCII escaping, quotes or line-by-line mode
3. Copy the result or review the highlighted changes

## Features

- 16 languages and formats, both directions
- JSON, three JS quote styles, Java, C#, C/C++, Go, Python
- SQL quotes, LIKE wildcards and bash-safe quoting
- Regex, CSV, XML/HTML and URL encoding
- Non-ASCII escaping, quoted output, line-by-line mode
- Every changed character highlighted
- Round trips verified against real compilers and interpreters

## FAQ

### What is the difference between JSON and JavaScript escaping?

JSON only allows \" \\ \/ \b \f \n \r \t and \uXXXX, and strings must use double quotes. JavaScript also has single-quoted and template strings plus \x, \v, \0 and \u{…}. U+2028 and U+2029 were line terminators in older JavaScript, so JS mode writes them as \u escapes.

### Does SQL escaping prevent SQL injection?

Doubling single quotes makes a standard SQL string literal safe, but databases, character sets and SQL modes have edge cases. In application code always use parameterized queries (prepared statements); this escaping is meant for hand-written SQL, test data and debugging.

### Why does shell escaping use single quotes?

Inside bash single quotes every character — $, backticks, backslashes, line breaks — is literal except the single quote itself, which becomes '\''. That makes it the safest quoting style. Text made only of letters, digits and safe characters like -_./:= is left unquoted.

### What does “unrecognized escape” mean when unescaping?

The input contains a backslash sequence the language does not define, such as \a or \x41 in JSON. Strict formats like JSON and Java keep it as is and warn you, Python keeps the backslash just like the interpreter, and JavaScript drops the extra backslash per the spec. Try another language, or check whether the text was escaped twice.

## Related tools

- [JSON Formatter](https://qilingtools.com/en/json): Free online JSON formatter: beautify or minify, validate with the exact line and column of any error, browse a collapsible tree, sort keys and escape strings.
- [Base64 Encode/Decode](https://qilingtools.com/en/base64): Free online Base64 encoder and decoder: UTF-8 safe, optional URL-safe variant, convert text to Base64 and back in real time. Processed locally, never uploaded.
- [URL Encode/Decode](https://qilingtools.com/en/url-encode): Free online URL encoder and decoder with encodeURIComponent and encodeURI modes. Escapes Chinese, spaces and special characters. Real-time and local, no upload.
- [JWT Decoder](https://qilingtools.com/en/jwt): Free online JWT decoder: decode the header and payload of a JSON Web Token, show expiry and issued-at times, all locally without uploading the token.
- [Timestamp Converter](https://qilingtools.com/en/timestamp): Free online Unix timestamp converter: convert timestamps and dates, auto-detect seconds or milliseconds, and show local, UTC, ISO 8601 and relative time.
- [Hash / Checksum](https://qilingtools.com/en/hash): Free online hash calculator: SHA-1, SHA-256, SHA-384 and SHA-512 of text or any file through the browser crypto API. Files never leave your device.
- [UUID Generator](https://qilingtools.com/en/uuid): Free online UUID generator: create RFC 4122 UUID v4 in bulk with a cryptographic RNG. Options for uppercase, no hyphens and braces, with one-click copy.
- [Base Converter](https://qilingtools.com/en/base-convert): Free online number base converter: convert between binary, octal, decimal, hexadecimal and any base 2–36. Uses BigInt for huge integers, computed locally.
