🏷️ Encoding Tool

HTML Entity Encoder & Decoder

Convert special characters to HTML entities and decode HTML entities back to readable text. Essential for XSS prevention and web development.

Use Named Entities
Encode All Characters

                    

                    

Common HTML Entities

Character Named Numeric Description
< &lt; &#60; Less than
> &gt; &#62; Greater than
& &amp; &#38; Ampersand
" &quot; &#34; Double quote
' &apos; &#39; Single quote
  &nbsp; &#160; Non-breaking space
© &copy; &#169; Copyright
® &reg; &#174; Registered
&trade; &#8482; Trademark
&euro; &#8364; Euro sign
&mdash; &#8212; Em dash
&bull; &#8226; Bullet

What Are HTML Entities?

HTML entities are special codes used to represent characters that have special meaning in HTML or cannot be typed on a standard keyboard. They start with & and end with ;. For example, &lt; represents the less-than sign (<) which would otherwise be interpreted as an HTML tag.

Why HTML Encoding Matters for Security

HTML encoding is the primary defense against Cross-Site Scripting (XSS) attacks. By encoding user input before displaying it on a page, you prevent malicious scripts from being executed. For example, encoding <script> to &lt;script&gt; renders it as harmless text.

FAQ

When should I HTML encode text?

Always encode user-supplied content before inserting it into HTML. This includes form inputs, URL parameters, database content, and any data from external sources. Modern frameworks like React do this automatically.

Named vs numeric entities?

Named entities (like &amp;) are more readable. Numeric entities (like &#38;) are more universal and support all Unicode characters. Named entities use fewer have browser support, while numeric work everywhere.