HTML Encode / Decode

LOCAL · IN-BROWSER

Encode HTML entities or decode them back. Escape <, >, & and other special characters.

Advertisement728 × 90
Plain text0 chars · 0 B
Encoded HTML
Advertisement728 × 90

About HTML Encode / Decode

Convert raw HTML to safely-escaped entities (&lt; &gt; &amp; &quot;) 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.

LearnHTML entities and escaping: &amp;, &lt;, and when you need them