HTML Entities Table

EntityRendersDecimalWhere it matters
&&&Escape everywhere - starts every other entity
&lt;<&#60;MUST escape in text - starts a tag
&gt;>&#62;Safe alone, escape for symmetry in text
&quot;"&#34;Escape inside double-quoted attributes
&apos;'&#39;Escape inside single-quoted attributes and JS-in-HTML
&nbsp; &#160;Non-breaking space - words glue, lines never break here
&copy;©&#169;Copyright sign - safe in UTF-8 pages as a literal too
&reg;®&#174;Registered sign
&trade;™&#8482;Trademark sign
&deg;°&#176;Degree sign - temperatures and angles
&mdash;—&#8212;Em dash - sentence-level break
&ndash;–&#8211;En dash - ranges like 3-5 or pages 12-19
&hellip;…&#8230;Ellipsis - one character, not three periods
&rsquo;’&#8217;Right single quote - apostrophe in typographic text
&eacute;é&#233;e with acute - legacy pages without UTF-8 need it
&euro;€&#8364;Euro sign
Character references exist because four characters mean something to the HTML parser itself: &amp; &lt; &gt; and &quot;. Only the first three are mandatory in text content - everything else on this table is optional sugar that predates reliable UTF-8. Rule of thumb from the MDN entity glossary: escape the parser characters, write everything else as a literal UTF-8 character, and reach for a named entity only when the character is invisible or hard to type (non-breaking space, typographic quotes). Numeric references (&#8212;) work for every Unicode character whether or not it has a name. Bottom line: a page that shows &amp; in the browser has been escaped twice - unescape once at the source. Related tools: escape html does the encoding for you, find and replace cleans double-escapes in bulk, smart quotes converter handles the typographic pair, and remove accents shows the other direction - stripping what entities preserve.

HTML has exactly four characters that mean something to the parser itself - the ampersand that starts every entity, the angle brackets that wrap tags, and the quote that wraps attribute values. Everything else called an "HTML entity" is optional sugar that predates reliable UTF-8. The table below covers the sixteen references you actually meet in real pages, with the decimal code for each and an honest note about where escaping is mandatory versus merely traditional.

Bottom line: in text content, only three escapes are required - &amp;amp;, &amp;lt; and &amp;gt;. In attributes, the quote character matters too. Every accented letter, arrow, dash and currency sign can be written as a literal UTF-8 character in a modern page; the named entities are for invisible characters (like the non-breaking space) and for editors that mangle anything outside ASCII.

The honest part: most "entity problems" are actually double-escaping. If the browser shows &amp;amp; or &amp;lt;code&amp;gt; as literal text, the string was encoded twice - once by a template and once by a library - and the fix is unescaping once at the source, not adding more escapes downstream.

How to use

  1. Find the character you need in the table - the first column shows the entity exactly as you would type it in HTML source.
  2. Check the last column before using it: it says whether the escape is mandatory (parser characters), situational (attributes), or optional style (dashes, quotes, currency).
  3. Use the decimal column when a character has no named entity or when a legacy system mangles names - numeric references work for every Unicode character.

Frequently asked questions

Which HTML entities are actually mandatory?

Three, in text content: &amp;amp; must be escaped because it starts every entity, and &amp;lt; / &amp;gt; must be escaped because they start and end tags. Add &amp;quot; when you are writing an attribute value delimited by double quotes (or &amp;apos; inside single quotes). Everything else - accents, symbols, dashes, currency - is optional in a UTF-8 page and exists for legacy or hard-to-type situations.

What is &amp;nbsp; and when should I use it?

It is a non-breaking space: a space where the line is not allowed to wrap. Use it between a number and its unit (10 km), in initials, or to keep a label glued to the value it labels. Do not use runs of them for layout spacing - that is how lines overflow on phones; margins and padding do that job.

Why does my page show &amp;amp; instead of &amp;?

The ampersand was escaped twice. The first escape turned &amp; into &amp;amp;; the second turned the ampersand inside that into &amp;amp;amp;, which the browser displays literally. It usually happens when a template and a library both escape the same string. Fix it by unescaping once at the source and letting exactly one layer do the encoding.

Should I use named entities like &amp;mdash; or numeric ones like &amp;#8212;?

Named entities are readable in source and fine for the common set on this table; numeric references work for every Unicode character, named or not, and survive systems that only understand ASCII. For a modern UTF-8 page the best default is none of the above - the literal character itself - and reach for an entity only for the parser characters and the invisible space.

Related tools