Search the site

HTML Entities: Complete Cheat Sheet of Symbols to Copy

Copyright, arrows, accents, currency and special spaces: the HTML code for every symbol in a ready-to-copy table, plus when to use entities, numeric codes or UTF-8.

You want to tell your readers that bold text is made with the <strong> tag. You write the sentence into your page’s code, save, and something odd happens in the browser: the word <strong> disappears and all the text after it turns bold. The culprit is that <: to HTML it isn’t a symbol to show, it’s the start of a tag.

To write characters like this, and many others you won’t find on your keyboard, HTML has a simple system: HTML entities. They’re short codes, like &lt; or &copy;, that the browser turns into the right symbol.

In this guide you’ll find a complete cheat sheet of the most used symbols, ready to copy with one click, and I’ll explain when to use an entity, when a numeric code and when you can simply type the character as it is.

What is an HTML entity?

An HTML entity is a way of writing a character using only letters and numbers. It always starts with & and ends with a semicolon. In between there’s the character’s name, or its number.

The same symbol can be written in three ways, and the result is identical:

  • By name: &copy;. Easy to remember, but it only exists for characters that have a name.
  • By decimal number: &#169;. Works with any character.
  • By hexadecimal number: &#xA9;. The same number in base 16, the one you see in Unicode codes like U+00A9.
The three spellings &copy;, &#169; and &#xA9;, all leading to the same copyright sign, Unicode code U+00A9.
Three ways to write the same symbol: by name, by decimal number and by hexadecimal number.

That number isn’t made up: it’s the code the Unicode standard gives to every character in the world. I cover it properly in the guide to ASCII, Unicode and UTF-8, but for now all you need to know is that every symbol has its number, and with that number you can always write it.

The five entities you need to know

There are more than two thousand names, but only five are truly essential. They’re the characters HTML uses for its own syntax, so when you need them as text they have to be written as entities.

CharacterEntityWhen you need it
&&amp;Always, in text and in attributes: it’s the character that opens every entity.
<&lt;In text: otherwise the browser takes it for the start of a tag.
>&gt;Hardly ever required, but used together with &lt; for clarity, for example when you show code.
"&quot;Inside an attribute written between double quotes, like title="...".
'&apos;Inside an attribute written between single quotes.
The five reserved HTML characters and when to write them as entities.

Warning

The & is the trickiest one. If you write it on its own and it’s followed by a word that looks like an entity name, the browser may convert it: Prices&copy becomes “Prices©”. In text, always write &amp; and you’ll have no surprises.

Entity, numeric code or the character itself?

This is the question that really matters. If your page declares the UTF-8 encoding, and almost every site does today, you can type most symbols directly: é, €, ©, →. The browser shows them with no codes at all.

HTML
<head>
  <!-- among the first lines of the page -->
  <meta charset="utf-8">
</head>

Entities are still useful in three cases:

  • For the five reserved characters you’ve just seen. There’s no alternative here.
  • For invisible characters, like the non-breaking space. Typed directly, you can’t tell it from a normal space; written as &nbsp;, you spot it immediately in the code.
  • When you can’t type the symbol, or you aren’t sure about the encoding of the file you’re writing in.

Tip

The numeric code is the wild card: &#8377; writes the Indian rupee sign even though it has no name. When a symbol has no named entity, the cheat sheet below gives you its numeric code instead.

The symbol cheat sheet

Here are the symbols you’ll need most often, grouped by category. For each one you get its name, the HTML entity (or the numeric code when there’s no name) and the Unicode code. “Copy” gives you the symbol, “Copy code” the entity to paste into your HTML.

Reserved characters

  • Ampersand

    &amp; U+0026

  • Less-than sign

    &lt; U+003C

  • Greater-than sign

    &gt; U+003E

  • Quotation mark

    &quot; U+0022

  • Apostrophe

    &apos; U+0027

Spaces and invisible characters

These are characters you can’t see, but they change how text wraps. The most useful is the non-breaking space: it keeps a number and its unit, or a title and a name, together, so they don’t end up on two different lines.

Two lines of text compared: with a normal space “10” stays at the end of the line and “km” wraps to the next one; with &nbsp; “10 km” stays together on the next line.
With a normal space the number and the unit split up; with &nbsp; they stay together.
  • No-break space

    &nbsp; U+00A0

  • Narrow no-break space

    &#8239; U+202F

  • Thin space

    &thinsp; U+2009

  • En space

    &ensp; U+2002

  • Em space

    &emsp; U+2003

  • Zero-width space

    &#8203; U+200B

  • Word joiner

    &#8288; U+2060

  • Soft hyphen

    &shy; U+00AD

The soft hyphen (&shy;) stays invisible as long as the word fits on the line. If the word has to wrap, the browser breaks it there and shows the hyphen: handy for very long words in narrow headings.

Punctuation and quotation marks

In polished writing, straight quotes " become typographic quotes: “ ” and ‘ ’ in English. And the short hyphen on your keyboard isn’t a dash: for ranges you use – (as in 9–5), and for breaks in a sentence —.

  • En dash

    &ndash; U+2013

  • Em dash

    &mdash; U+2014

  • Ellipsis

    &hellip; U+2026

  • Left guillemet

    &laquo; U+00AB

  • Right guillemet

    &raquo; U+00BB

  • Left double quotation mark

    &ldquo; U+201C

  • Right double quotation mark

    &rdquo; U+201D

  • Left single quotation mark

    &lsquo; U+2018

  • Right single quotation mark (typographic apostrophe)

    &rsquo; U+2019

  • Double low quotation mark

    &bdquo; U+201E

  • Middle dot

    &middot; U+00B7

  • Bullet

    &bull; U+2022

  • Prime (minutes, feet)

    &prime; U+2032

  • Double prime (seconds, inches)

    &Prime; U+2033

  • Inverted question mark

    &iquest; U+00BF

  • Inverted exclamation mark

    &iexcl; U+00A1

Copyright and marks

  • Copyright sign

    &copy; U+00A9

  • Registered sign

    &reg; U+00AE

  • Trade mark sign

    &trade; U+2122

  • Sound recording copyright

    &copysr; U+2117

  • Section sign

    &sect; U+00A7

  • Pilcrow (paragraph sign)

    &para; U+00B6

  • Dagger

    &dagger; U+2020

  • Double dagger

    &Dagger; U+2021

  • Numero sign

    &numero; U+2116

  • Degree sign

    &deg; U+00B0

Currency symbols

  • Euro sign

    &euro; U+20AC

  • Dollar sign

    &dollar; U+0024

  • Pound sign

    &pound; U+00A3

  • Yen sign

    &yen; U+00A5

  • Cent sign

    &cent; U+00A2

  • Indian rupee sign

    &#8377; U+20B9

  • Won sign

    &#8361; U+20A9

  • Generic currency sign

    &curren; U+00A4

Arrows

  • Leftwards arrow

    &larr; U+2190

  • Rightwards arrow

    &rarr; U+2192

  • Upwards arrow

    &uarr; U+2191

  • Downwards arrow

    &darr; U+2193

  • Left right arrow

    &harr; U+2194

  • Up down arrow

    &varr; U+2195

  • Leftwards double arrow

    &lArr; U+21D0

  • Rightwards double arrow

    &rArr; U+21D2

  • Left right double arrow

    &hArr; U+21D4

  • Return arrow

    &crarr; U+21B5

  • Leftwards arrow with hook

    &larrhk; U+21A9

  • Rightwards arrow with hook

    &rarrhk; U+21AA

  • North east arrow

    &nearr; U+2197

  • South east arrow

    &searr; U+2198

  • South west arrow

    &swarr; U+2199

  • North west arrow

    &nwarr; U+2196

Math symbols

The minus sign from &minus; is wider than the hyphen on your keyboard, and it’s the right one in formulas: “−5” reads better than “-5”. The same goes for the multiplication sign: “3 × 4” instead of “3 x 4”.

  • Multiplication sign

    &times; U+00D7

  • Division sign

    &divide; U+00F7

  • Plus-minus sign

    &plusmn; U+00B1

  • Minus sign

    &minus; U+2212

  • Not equal to

    &ne; U+2260

  • Almost equal to

    &asymp; U+2248

  • Less-than or equal to

    &le; U+2264

  • Greater-than or equal to

    &ge; U+2265

  • Infinity

    &infin; U+221E

  • Square root

    &radic; U+221A

  • Summation

    &sum; U+2211

  • Pi

    &pi; U+03C0

  • One half

    &frac12; U+00BD

  • One quarter

    &frac14; U+00BC

  • Three quarters

    &frac34; U+00BE

  • Per mille sign

    &permil; U+2030

  • Superscript two

    &sup2; U+00B2

  • Superscript three

    &sup3; U+00B3

  • Micro sign

    &micro; U+00B5

Accented letters

In UTF-8 pages you can type them directly. Entities come in handy for letters your keyboard doesn’t have, like the capital É: on Windows you can also hold Alt and type 0201 on the numeric keypad.

  • a with grave accent

    &agrave; U+00E0

  • e with grave accent

    &egrave; U+00E8

  • e with acute accent

    &eacute; U+00E9

  • i with grave accent

    &igrave; U+00EC

  • o with grave accent

    &ograve; U+00F2

  • u with grave accent

    &ugrave; U+00F9

  • Capital A with grave accent

    &Agrave; U+00C0

  • Capital E with grave accent

    &Egrave; U+00C8

  • Capital E with acute accent

    &Eacute; U+00C9

  • Capital I with grave accent

    &Igrave; U+00CC

  • Capital O with grave accent

    &Ograve; U+00D2

  • Capital U with grave accent

    &Ugrave; U+00D9

  • c with cedilla

    &ccedil; U+00E7

  • n with tilde

    &ntilde; U+00F1

  • u with diaeresis

    &uuml; U+00FC

  • Sharp s (eszett)

    &szlig; U+00DF

Other symbols

  • Check mark

    &check; U+2713

  • Ballot X

    &cross; U+2717

  • Black star

    &starf; U+2605

  • White star

    &star; U+2606

  • Heart suit

    &hearts; U+2665

  • Diamond suit

    &diams; U+2666

  • Club suit

    &clubs; U+2663

  • Spade suit

    &spades; U+2660

  • Telephone

    &phone; U+260E

  • Eighth note

    &sung; U+266A

  • Lozenge

    &loz; U+25CA

  • White circle

    &cir; U+25CB

The most common mistakes with entities

  • Forgetting the semicolon. Some entities work without it, for compatibility with old HTML, but many don’t. Always add it.
  • Getting the case wrong. Names are case-sensitive: &eacute; is “é”, &Eacute; is “É”.
  • Converting twice. If your page shows &amp; instead of &, the text has been converted twice: & became &amp;, and then &amp;amp;.
  • Using entities outside HTML. They only work in HTML. In JavaScript, CSS or Python, special characters are written another way, with a backslash.

That last point opens up a whole world. Entities are HTML’s way of saying “this character is text, not code”. Other languages have the same problem with quotes and line breaks, and they solve it with escape sequences, like \n and \".

Frequently asked questions

How do I write the © symbol in HTML?

With the entity &copy;, with the code &#169;, or by typing © directly if the page is UTF-8. The result is identical.

What’s the difference between &nbsp; and a normal space?

A non-breaking space prevents a line break at that point, and the browser doesn’t merge it with other spaces. Use it to keep a number and its unit together, not to create empty space: that’s a job for CSS.

Do I still need HTML entities with UTF-8?

For most symbols, no: you type them directly. You still need them for the reserved characters (&, <, > and quotes inside attributes), and they’re handy for invisible characters.

How do I type a capital É?

In HTML with &Eacute;, or by copying it from the cheat sheet above. On Windows you can also hold Alt and type 0201 on the numeric keypad.

Why do I see &amp; on my page instead of &?

Because the text was converted twice: the first time the & became &amp;, the second time the & of that code was converted too. It should be converted only once, right before it goes into the HTML.

How many HTML entities are there?

The HTML standard lists 2,231 named ones. Of these, 106 are the old form without a semicolon, kept for compatibility with older pages. For every other character there’s always the numeric code.

Sources and further reading

Now you know how to write any symbol in HTML without breaking the page. But if you also work with JavaScript, Python or PHP, sooner or later you’ll meet a string that stops halfway because of a quote. In the next article I explain escape sequences: what \n, \t and \" are, and how to use them without mistakes.

Comments

No comments yet. Leave the first one!

Leave a comment

I accept the Privacy Policy