HTML special characters (entities)

adding non-alpha/numeric text
// updated 2025-04-25 12:03

At least two kinds of special characters exist in HTML:

  • Entities
    • characters which do not appear on all keyboards; or
    • characters that would interfere with HTML code such as < and >
  • Emoji
    • icons no longer need to be image files stored on some server
    • ...as they can now use these "text-like" characters 😁

Entities

There are two ways to encode entities:

&lt; <!-- "less than" - encoding by "name" -->
&#60; <!-- "less than" - encoding by "#number" -->

Common entities include:

table
AppearanceMeaningBy nameBy number
non-breaking space&nbsp;&#160;
<less than&lt;&#60;
>more than&gt;&#62;
&ampersand&amp;&#38;
¢cent&cent;&#162;
euro&euro;&#8364;
£pound&pound;&#163;
©copyright&copy;&#169;
®registered trademark&reg;&#174;
trademark&trade;&#8482;

Remember that HTML entities by name are case sensitive:

  • i.e. &euro; will work but not &Euro;

Emoji

Emoji (note: plural is also emoji) are just symbols like $ or ¢ and we can simply input them using:

  • an emoji keyboard
    • something almost everyone who uses emoji would use
      • on Mac : control + command + space or fn + E
      • on Windows : Windows + . (period)
  • HTML entity code (such as &#128516 for 😄)
    • a much, much less commonly used method

We also need to ensure that the <head> contains the following reference to Unicode (UTF-8) for emoji to appear on the page:

<head>
    ...
    <meta charset="UTF-8">
    ...
</head>

Fun fact: the resemblance of the word "emoji" to "emotion" is actually a complete coincidence!

⬅️ older (in textbook-html)
🛡️ HTML tags
newer (in textbook-html) ➡️
HTML <form> and <input> tags 🛡️
⬅️ older (in code)
🛡️ HTML tags
newer (in code) ➡️
Git command aliasing 🐙
⬅️ older (posts)
🛡️ HTML tags
newer (posts) ➡️
On brands 🤔