HTML Entities Encoder / Decoder converts characters like <, >, &, and " to their HTML entity equivalents and vice versa. It also handles non-ASCII characters by encoding them as numeric character references. A collapsible reference table lists common entities.
HTML entities prevent user-supplied text from being interpreted as HTML markup. This is essential for preventing cross-site scripting (XSS) vulnerabilities when displaying user content on a web page.
Decoding handles all named HTML entities recognized by the browser's HTML parser (via the browser's own textarea-based decoding), so it covers a very wide range including ©, €, …, and more. Encoding uses numeric references (&#NNN;) for non-ASCII characters rather than named entities, for maximum compatibility.
The five reserved HTML/XML characters — & < > " ' — are always encoded to their named entities. Any other non-ASCII character (accented letters, emoji, symbols) is encoded as a numeric character reference like é.
No. HTML entity encoding escapes characters for safe placement inside HTML markup or text content. URL encoding (percent-encoding) escapes characters for safe placement inside a URL. They use different character sets and encoding schemes.
Decoding sets the entity string as the innerHTML of a hidden textarea element and reads back its value — this lets the browser's own battle-tested HTML parser handle every named and numeric entity correctly, rather than reimplementing entity tables manually.
Encoding here escapes special characters for safe display as plain text, but it does not sanitize or validate HTML structure. For rendering untrusted HTML safely, use a dedicated sanitization library server-side or client-side, not just entity encoding.
No. Decoding only reads the resulting text value of the hidden textarea — it never renders the content as live HTML in the page, so scripts or tags in the decoded output are not executed.