What is String Escaping?
String escaping converts special characters into escape sequences that are safe for use in specific contexts — JSON strings, HTML entities, URL encoding, SQL queries, regex patterns, and more. Unescaping reverses the process. This tool supports 12 formats including JSON, HTML, URL, XML, CSV, JavaScript, Python, Java, SQL, regex, Base64, and Unicode.
Common use cases
- Escaping strings for safe inclusion in JSON payloads
- Converting special characters to HTML entities
- Preparing strings for SQL queries (preventing injection)
- Escaping regex special characters in search patterns
- Converting between different escape formats
How to use
- 1Pick Escape or Unescape and the target format (JSON, HTML, URL, SQL, Regex, Shell, Java, Python…).
- 2Paste your string on the left; turn on Show diff to highlight what changed.
- 3Copy or download the output, or Swap to reverse the conversion.
Frequently asked questions
Why do strings need escaping?
Special characters like quotes, backslashes, angle brackets, and ampersands have meaning in programming languages and data formats. Escaping replaces them with safe representations so they're treated as literal text, not syntax. Failing to escape can cause bugs or security vulnerabilities like XSS and SQL injection.
What is the difference between encoding and escaping?
Escaping adds a prefix character (like backslash) to indicate a literal interpretation. Encoding transforms the character into a different representation (like %20 for space in URLs or & for & in HTML). Both solve the same problem with different approaches.