HTML Encoder/Decoder — Escape and Unescape HTML Entities Instantly
Convert special HTML characters to entities (&, <, >) or decode them back to text.
What Is HTML Encode / Decode?
Convert special HTML characters to entities (&, <, >) or decode them back to text.
HTML encoding converts characters that have special meaning in HTML into their entity equivalents — the most critical being < (for <), > (for >), & (for &), and " (for "). Without HTML encoding, user-supplied text rendered in a web page can break the HTML structure or, worse, execute malicious scripts — a class of attack called Cross-Site Scripting (XSS).
Any text that originates outside your system — from a form input, a database, or an API — and is displayed in HTML must be entity-encoded first. Conversely, HTML decoding converts entities back to readable characters for text processing or display in non-HTML contexts like plain-text emails and Markdown.
<h1>Hello & "World"</h1>→<h1>Hello & "World"</h1>When to Use the HTML Encode / Decode
- →Preventing XSS vulnerabilities — user input displayed in HTML must be entity-encoded to prevent script injection attacks on your web application
- →Displaying code examples on web pages — HTML and XML code samples must be encoded so browser tags render as visible text, not as actual elements
- →Processing HTML content from APIs — when receiving HTML content in JSON responses, entities must be decoded to extract plain text
- →Cleaning text from HTML editors — rich text editors (WordPress, TinyMCE) store encoded entities in the database that need decoding for plain-text use
- →Preparing content for HTML email templates — dynamic text inserted into email templates must be properly encoded to prevent rendering issues
How to Use the HTML Encode / Decode
- Select Encode or Decode using the toggle buttons.
- Paste your text into the Input Text box.
- The result appears instantly on the right.
- Click Copy to copy the output to your clipboard.
Frequently Asked Questions
Everything you need to know about HTML Encode / Decode
HTML encoding converts special characters that have meaning in HTML (like <, >, &, ") into their entity equivalents (<, >, &, ") so browsers display them as text instead of interpreting them as markup.