Text Escape & Unescape Tool
Prepare text for a specific syntax rather than manually replacing characters. Choose the destination format, escape or decode it, and reverse the result when checking a round trip.
Browser-based · No account required · Copy and export
Workspace
PixelOkay · Developer toolsHow to use Text Escape & Unescape Tool
- Choose HTML/XML text, a URL component or JSON-compatible string syntax.
- For JSON or JavaScript mode, choose string content or a complete double-quoted JSON string literal. Paste the matching representation.
- Convert and review the result. Reusing the output also reverses the direction; malformed escapes produce a visible error.
When to use this tool
Prepare text for an HTML, JSON-string or URL-component context. Choose the destination context explicitly; escaping for one format does not make a value safe in every other format.
Escaping depends on context
HTML escaping changes markup characters into entities. URL component encoding uses percent escapes for the UTF-8 representation of a value. JSON string syntax escapes quotes, backslashes and control characters. Content mode omits the enclosing quotes; literal mode includes them. JavaScript mode here intentionally uses JSON-compatible double-quoted escapes rather than every JavaScript literal feature.
Worked example
Text containing a newline:
Hello
world
JSON string content: Hello\nworld
Complete JSON literal: "Hello\nworld"
URL component for a+b: a%2BbLimits and output checks
Escaping does not make text safe in every HTML, CSS, JavaScript or URL context. This tool is not an HTML sanitizer. It does not parse template literals, single-quoted JavaScript literals or arbitrary source code. Invalid percent/UTF-8 or JSON escape sequences are rejected.
Reference: JSON string syntax.
Frequently asked questions
Should I include the outer JSON quotes?
Include them only when complete JSON literal mode is selected. Content mode expects the escaped characters between those quotes.
Why does URL decoding keep a plus sign?
URL component mode uses decodeURIComponent. Form/query encoding, where plus may mean a space, is a different convention.
Can the result be inserted anywhere in HTML?
No. The correct escaping and allowed values depend on the destination context. Validate the surrounding markup and URL scheme separately.
Escape for the destination context
Choose the supported string or URL mode before transforming text. Select complete-literal mode only when the input includes the enclosing JSON quotes.
Scope of this workflow
Escaping is not universal sanitization. HTML, CSS, JavaScript and URL destinations have different surrounding syntax and allowed-value rules.
URL Encoder & Decoder - URI, Component & Form · All developer tools · Privacy policy · Contact PixelOkay