& HTML Escape/Unescape
Escape and unescape HTML special characters. Convert & < > " ' and back.
About the HTML Escape/Unescape tool
Use this tool to escape HTML special characters into their entity form, or to convert entity-encoded text back into raw characters. Common use cases include pasting code snippets into a blog post, sanitizing text that will be inserted via innerHTML, and decoding entity-encoded text scraped from HTML.
Characters handled
&→&<→<>→>"→"'→'
Frequently asked questions
Why is & replaced first when escaping? Because the replacement text contains &. Replacing it last would double-escape already-escaped entities.
Does this protect against XSS? Escaping neutralizes the most common XSS vectors in static HTML, but it is not a substitute for proper contextual output encoding on the server side.
Are numeric entities like ' supported? Yes. The unescape pass decodes both named entities (<, ", etc.) and numeric entities (', ', ", etc.).