HTML Entity Encoder / Decoder

Encode special characters as HTML entities to prevent XSS, or decode entities back to readable text. Includes a quick-reference card for common entities.

<h1 class="title">Hello & "World" © 2024</h1>

Common entities

& = &amp;< = &lt;> = &gt;" = &quot;© = &copy;® = &reg; = &nbsp;

Frequently Asked Questions

What are HTML entities?

HTML entities are codes that represent special characters in HTML. For example, &amp; represents &, &lt; represents <, and &gt; represents >. They prevent the browser from interpreting the characters as HTML code.

When should I encode HTML?

Always encode user-supplied content before inserting it into HTML to prevent XSS (cross-site scripting) attacks. At minimum, encode &, <, >, ", and '.

What is the &nbsp; entity?

&nbsp; is a non-breaking space — it looks like a regular space but prevents line breaks between two words and is not collapsed by HTML whitespace rules.