PrimeUtil

String Escape / Unescape

Escape and unescape strings across multiple formats in one place — JSON strings, URL percent-encoding, HTML entities, SQL string literals, and regex special characters. Switch formats instantly with a click. Essential for debugging API payloads and building test scripts.

Format

Escape special characters for use inside a JSON string value

Result will appear here.

JSON Escape Sequences

CharacterEscapedDescription
"\"Double quote
\\\Backslash
(newline)\nLine feed
(tab)\tHorizontal tab
(carriage return)\rCarriage return
(form feed)\fForm feed
(backspace)\bBackspace

Features

  • JSON string escaping and unescaping
  • URL percent-encoding and decoding
  • HTML entity encoding and decoding
  • SQL string literal escaping
  • Regex special character escaping

Frequently Asked Questions

What is string escaping?
String escaping converts special characters to a format that is safe for use in a specific context. For example, a double quote inside a JSON string must be escaped as \" so the parser knows it is part of the string value, not the end of it.
When do I need to escape for SQL?
When building SQL queries with string values, single quotes must be escaped (typically by doubling them: '') to prevent syntax errors or SQL injection. Always prefer parameterized queries in production code.
What is the difference between URL encode and HTML encode?
URL encoding converts characters to %XX format for safe inclusion in a URL. HTML encoding converts characters to &name; or &#nn; format for safe inclusion in HTML markup. They serve different contexts.