📄 HTML Entity Encoder

HTML entity encoding and decoding

Output Result

📚 User Guide

What is HTML Entity?

HTML entities are codes used to display reserved or special characters in HTML. They start with & and end with ;.

Why need HTML Entities?

  • Some characters are reserved in HTML (such as <, >, &)
  • Prevent XSS attacks
  • Display special symbols
  • Ensure correct character display

Common HTML Entities

Character Entity Name Entity Number Description
< &lt; &#60; Less than
> &gt; &#62; Greater than
& &amp; &#38; Ampersand
" &quot; &#34; Double quote
' &apos; &#39; Single quote
Space &nbsp; &#160; Non-breaking space
© &copy; &#169; Copyright symbol

Use Cases

  • Display code in HTML
  • Prevent XSS injection attacks
  • Display special symbols
  • Escape user input

Examples

Original text:
Hello & "World"
Encoded: &lt;div class=&quot;example&quot;&gt;Hello &amp; &quot;World&quot;&lt;/div&gt;

Security Tips

  • Always escape user input for HTML
  • Do not trust data from client-side
  • Use Content Security Policy (CSP)
  • Regularly check for XSS vulnerabilities