Skip to main content
Back to tools

HTML Entities

Encode and decode HTML entities

About HTML Entities

Escapes &, <, >, double quotes and apostrophes as &amp;, &lt;, &gt;, &quot; and &#39;, and decodes HTML entities back into plain text. Decoding goes through the browser's own HTML parser, so it understands every named entity in the HTML standard plus decimal and hexadecimal references, while any tags in the input remain literal text. Handy for showing code samples in HTML or reading escaped API output.

Category: Encoding.

Frequently asked questions

What are HTML entities?

▾

Special codes that represent characters with reserved meaning in HTML or characters not easily typed. &amp; represents &, &lt; represents <, &gt; represents >, &nbsp; represents a non-breaking space.

When do I need to encode HTML entities?

▾

When embedding user input or dynamic data inside HTML — especially <, >, &, and " — to prevent the browser from interpreting them as HTML tags or attributes, which could enable XSS attacks.

What is the difference between named and numeric entities?

▾

Named entities (&amp;) are human-readable. Numeric entities use the character's code point: &#38; (decimal) or &#x26; (hexadecimal) — both represent &. All three forms are equivalent.

Why aren't accented letters or emoji encoded?

▾

Encode only escapes the five characters that can break markup or attribute values. Letters like é, symbols like © and emoji are valid as-is in a UTF-8 page, so they're left unchanged. Text that already contains entities is escaped again, so &amp; becomes &amp;amp;.

Related tools