Free Online String Escaper
Escape and unescape HTML entities and JSON string characters. Switch between four modes: HTML encode, HTML decode, JSON escape, and JSON unescape.
Input
Output
Mode Reference
HTML Encode
Converts &, <, >, ", and ' to their HTML entity equivalents (& < > " '). Use before inserting user-supplied text into HTML to prevent XSS.
HTML Decode
Reverses HTML encoding. Converts entities like &, <, and " back to their literal characters.
JSON Escape
Escapes a string so it is safe to embed as a JSON string value: backslashes, double quotes, newlines, tabs, and control characters become \, \", \n, \t, etc.
JSON Unescape
Reverses JSON string escaping. Converts \n back to a real newline, \" back to a double quote, etc. Input should be the inner content of a JSON string (without the outer quotes).