100% Private

HTML Entity Encoder & Decoder

HTML Entity Encoding

HTML uses certain characters for syntax: < and > for tags, & for entities, quotes for attributes. When these characters appear in content, they must be encoded as entities to display correctly and prevent security issues.

Essential Entities

  • &lt; — Less than (<)
  • &gt; — Greater than (>)
  • &amp; — Ampersand (&)
  • &quot; — Double quote (")
  • &apos; — Single quote/apostrophe (')

Security: Preventing XSS

Cross-site scripting (XSS) attacks inject malicious scripts through unescaped user input. When displaying user-generated content, encoding prevents <script> tags from executing. Always encode untrusted data before rendering in HTML.

Named vs Numeric Entities

Named entities like &copy; (©) are readable but not available for all characters.

Numeric entities like &#169; (also ©) work for any Unicode character. Use decimal (&#169;) or hexadecimal (&#xA9;) format.

Displaying Code

When showing HTML code examples on web pages, encode all tags so they display as text rather than being interpreted. This is essential for documentation and tutorials.


Privacy Notice: This site works entirely in your browser. We don't collect or store your data. Optional analytics help us improve the site. You can deny without affecting functionality.