HTML Entity Encoder & Decoder
Convert <script> β <script>. Encode escapes special characters so the browser shows them as literal text; decode reverses both named (&) and numeric (❤) entities.
Output appears here.
What are HTML entities?
Why they exist
HTML uses < and > to mark up tags. If you actually want to display a less-than sign on a page, you can't just type it β the browser will think you're starting a tag. HTML entities solve this by replacing each problem character with a placeholder the browser knows how to render as text.
The five basic entities
<β less-than<>β greater-than>&β ampersand&"β double quote"'β apostrophe'(named form'works in HTML5 but not older HTML)
Numeric entities
Any Unicode character can be written as &#NNN; (decimal) or &#xHHH; (hex). Example: ❤ = β€. Useful for emoji or characters your keyboard doesn't have.
Security context
HTML entity encoding is the foundation of XSS prevention. When you take user input and render it in a page, you encode it first β that way <script> becomes literal text instead of executable script. Every modern templating engine does this automatically.