HTML entities let you write a character that the parser would otherwise misinterpret, or that is hard to type. The full HTML entities list runs to more than two thousand names, but only a handful are required, and the rest are conveniences that a UTF-8 document rarely needs.

This HTML entities cheat sheet separates the two. Knowing which characters genuinely must be escaped prevents both broken markup and the over-escaping that produces visible entity text on a page.

The characters you must escape

Only three characters are dangerous in ordinary text content. The less-than sign becomes <, the greater-than sign becomes >, and the ampersand becomes &. Without escaping, the parser reads them as the start of a tag or of an entity.

Inside attribute values, quotation marks matter too: " for double and ' for single. The named form ' is valid in HTML5 but was never part of HTML4, so the numeric reference is the safer choice in output that may be consumed by older parsers.

Named, decimal, and hexadecimal forms

Every entity has up to three spellings. The copyright symbol can be written as the named ©, the decimal ©, or the hexadecimal ©. All three produce the same character, and the semicolon is required in every case.

Named forms are more readable and should be preferred where one exists. Numeric forms work for any character in Unicode, including those with no name, which makes them the fallback for symbols outside the standard table.

Spaces and dashes

The non-breaking space,  , prevents a line break at that point and stops consecutive spaces from collapsing. It is right for keeping a number with its unit or a name with a title, and wrong as a layout tool, where it produces text that cannot wrap sensibly on a small screen.

Dashes have distinct meanings. The en dash – marks ranges such as page numbers, the em dash — separates clauses, and the hyphen-minus on the keyboard is neither. The minus sign − is a fourth character again, correctly aligned for mathematics.

Quotation marks and punctuation

Typographic quotes are ‘ and ’ for single, “ and ” for double. The right single quote is also the correct apostrophe in English, which matters for search and for text-to-speech more than most people assume.

Other common punctuation includes the ellipsis …, which is one character rather than three periods, the middle dot ·, and the bullet •. Using the single-character forms keeps line breaking and copy-and-paste behaviour correct.

Arrows and mathematical symbols

The four basic arrows are ←, →, ↑, and ↓, with double-line versions such as ⇒ using a capital letter. These are widely supported and render consistently across fonts, which is not true of the many decorative arrows in higher Unicode ranges.

Mathematical entities include × for multiplication, ÷, ±, ≠, ≤, and ≥. Using × rather than the letter x in dimensions is a small correctness detail that improves both typography and screen reader output.

Currency, legal, and symbol characters

Currency symbols have named entities including €, £, ¥, and ¢. Legal marks are ©, ®, and ™. The degree sign is °, and the check mark ✓ is useful in lists though its appearance varies by font.

Brackets that are not part of markup need no escaping at all. Square brackets and parentheses are ordinary characters, and curly braces are only meaningful to template engines, not to the HTML parser. Escaping them adds noise without adding safety.

HTML entities complete list of the codes you actually need

Knowing how to use HTML entities is mostly knowing which few you need. What are HTML character entities, in one line: named or numeric references that stand in for a character. An HTML entities complete list runs to thousands of names, most of them legacy. The table below is the working subset: the entities that appear in real documents, with their numeric equivalents.

CharacterNamedNumericUse
&&&HTML entities & must always be escaped
<&lt;&#60;HTML entities opening angle bracket
>&gt;&#62;Closing angle bracket
"&quot;&#34;Inside double-quoted attributes
'&apos;&#39;Numeric form is safer in older parsers
(space)&nbsp;&#160;Non-breaking space
&ndash;&#8211;HTML entities dash for ranges
&mdash;&#8212;Em dash for clauses
·&middot;&#183;HTML entities dot separator
&bull;&#8226;HTML entities bullet
&check;&#10003;HTML entities checkmark
©&copy;&#169;HTML entities copyright
®&reg;&#174;Registered trademark
&trade;&#8482;Trademark
&rarr;&#8594;HTML entities arrow right
&larr;&#8592;Left arrow
&uarr;&#8593;Up arrow
&darr;&#8595;HTML entities arrow down
&rArr;&#8658;Double arrow; HTML entities arrows use a capital for these
[none&#91;HTML entities brackets need no escape in text
\none&#92;HTML entities backslash is an ordinary character
&hellip;&#8230;Ellipsis as one character
×&times;&#215;Multiplication, not the letter x
°&deg;&#176;Degree sign
&euro;&#8364;Currency; HTML entities and symbols follow the same rules

Two entries need a caveat. There is no entity that forces a line break: HTML entities break line behaviour comes from the <br> element or from CSS, not from a character reference. And an HTML entities codes lookup for a symbol with no name always has a numeric answer, since every Unicode character has one.

When to use the character directly

In a UTF-8 document, almost every entity is optional. Writing the em dash, the euro sign, or an arrow directly in the source is valid, more readable, and produces identical output. Reserve entities for the characters that must be escaped and for invisible ones where the entity documents intent.

The non-breaking space is the clearest example of the second case, since the character itself is indistinguishable from an ordinary space in an editor. Zero-width characters follow the same reasoning: use the entity so the next person editing the file can see that something is there.

Escaping in practice

Do not escape by hand. Every template engine escapes output automatically, and every language provides a function such as htmlspecialchars() for the cases where you generate markup yourself. Manual escaping combined with automatic escaping is what produces visible entity text on a rendered page.

Escaping requirements also depend on context. A value inside a URL attribute, a script block, or a style block needs URL or JavaScript escaping rather than HTML entity escaping, and applying the wrong one leaves an injection path open while appearing to be safe.

Looking up an unfamiliar entity

When you encounter an entity you do not recognise, decoding it is faster than scanning an HTML entities chart, and it removes the risk of matching a similar name in an HTML entity code list. Several entities differ by a single letter while producing visibly different characters, and a few named forms are legacy aliases that modern documents should not use.

Use this HTML entities reference the way you would a dictionary rather than reading it through. An HTML entities decode online panel resolves an unknown reference faster than scanning the table, and html entities decode operations are cheap enough to run on anything you are unsure about.

The reverse direction is equally useful. Pasting a character into an encoder shows its numeric reference, which is how you find the code for a symbol you copied from a document but cannot name. That is the practical route to entities outside the common set, since most of the two thousand named forms exist for historical compatibility rather than for everyday writing.

References: the WHATWG named character reference table is the authoritative entity list, and the OWASP XSS Prevention Cheat Sheet covers context-aware escaping.