What Are HTML Entities and When Should You Use Them?

HTML entities are special codes that represent characters which have reserved meaning in HTML or cannot be typed directly. They prevent browsers from misinterpreting content as HTML markup and allow you to display characters that aren't available on standard keyboards.

Clean HTML from unnecessary tags using our HTML Tags Remover tool.

Why HTML Entities Exist

HTML uses certain characters as part of its syntax: angle brackets (< >) define tags, ampersands (&) begin entities, quotation marks delimit attribute values. If you want to display these characters as content rather than have the browser interpret them as markup, you need to escape them.

Without escaping: <p>5 > 3 and 2 < 4</p> — the > and < might be interpreted as broken tag syntax. With escaping: <p>5 &gt; 3 and 2 &lt; 4</p> — renders as: 5 > 3 and 2 < 4

The Most Important HTML Entities

&amp; — & (ampersand) — always escape in HTML content &lt; — < (less than) — always escape in HTML content &gt; — > (greater than) — escape when ambiguous &quot; — " (double quote) — escape inside attribute values using double quotes &apos; — ' (single quote / apostrophe) — escape inside attribute values using single quotes &nbsp; — non-breaking space — prevents line break at that point &copy; — © (copyright symbol) &reg; — ® (registered trademark) &trade; — ™ (trademark) &mdash; — — (em dash) &ndash; — – (en dash) &hellip; — … (ellipsis) &euro; — € (euro sign)

Named vs Numeric Entities

HTML entities come in two forms:

Named: &copy; — human-readable, supported for common characters Numeric decimal: &#169; — works for any Unicode character Numeric hex: &#xA9; — same as decimal but in hexadecimal

All three produce the same output: ©. Named entities are easier to read and write. Numeric entities work for any Unicode character, including ones without a named entity.

For emoji or unusual Unicode: &#x1F600; produces 😀

When You Actually Need Entities vs UTF-8

Modern HTML pages declare UTF-8 encoding (<meta charset="UTF-8">). With UTF-8, you can type most characters directly — ©, €, —, … — without using entities. The browser renders them correctly.

You still always need to escape: & < > in content, and " or ' inside attribute values.

Everything else (typographic quotes, dashes, currency symbols, emoji) can be typed directly in UTF-8 HTML. Using entities for them is not wrong but is unnecessary verbosity.

Remove unwanted HTML tags and clean up markup instantly

Try HTML Tags Remover Free →

FAQs

Only the same type of quote used to delimit the attribute value. If you use double quotes for the attribute: href="page.html" — escape any double quotes inside the value as &quot;. Single quotes inside don't need escaping. If you use single quotes for the attribute, escape single quotes inside as &apos;.
Modern browsers are forgiving and typically render it correctly. However, it is invalid HTML and validators will flag it. More importantly, it can cause issues in XML-based contexts (XHTML, SVG, XML feeds) where parsers are strict. It also causes issues in some URL contexts. Always escape ampersands as &amp; in HTML content.
Rarely. &nbsp; is for preventing line breaks between specific words (like "100&nbsp;km") or preventing elements from collapsing. It should not be used as a substitute for CSS padding or margin — using multiple &nbsp; to create visual spacing is an antipattern that creates accessibility and maintenance problems. Use CSS for layout and spacing.
Scroll to Top
Checker Tools