HTML Encode / Decode
Encode HTML entities or decode them back. Escape <, >, & and other special characters.
About HTML Encode / Decode
Convert raw HTML to safely-escaped entities (< > & ") or decode entities back to their original characters. Essential for displaying code samples in HTML, preventing XSS vulnerabilities, and sanitizing user-generated content before rendering. Handles all named and numeric HTML entities.
All processing happens entirely in your browser using modern web APIs. Nothing is uploaded to our servers — your data stays local and private. Free to use forever.
Common use cases
- Displaying HTML source code inside a <pre> or <code> tag without it being parsed
- Sanitizing user input before inserting into HTML to prevent XSS attacks
- Decoding HTML entities from scraped web content or RSS feeds
- Preparing HTML snippets for embedding in emails or markdown documents
- Debugging double-encoded HTML from templating engines
How it works
Encoding uses a textarea element's textContent/innerHTML trick to leverage the browser's native HTML entity encoder — the same engine used by the browser itself. Decoding uses the reverse: inserting the encoded string as innerHTML and reading back the textContent. This ensures 100% compatibility with all named and numeric entities.