Some characters have a special job in HTML, and others are hard to type on a normal keyboard. Character entities let you show them safely.
Why entities are needed
The browser reads < as the start of a tag. So if you want to write "5 < 10" or show a tag like <p> as text, the browser gets confused. Entities solve this by spelling the character out in code.
An entity starts with & and ends with ;. It can use a name or a number:
- By name:
< - By decimal number:
< - By hexadecimal number:
<
All three display the same < character.
The essential entities
| Character | Entity name | Number | Description |
|---|---|---|---|
< | < | < | Less than |
> | > | > | Greater than |
& | & | & | Ampersand |
" | " | " | Double quote |
' | ' | ' | Apostrophe |
| (space) | |   | Non-breaking space |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Entities</title>
</head>
<body>
<p>To make a paragraph, write <p> at the start and </p> at the end.</p>
<p>Maths: 5 < 10 and 20 > 15.</p>
<p>Company: Otieno & Sons Hardware</p>
</body>
</html>Try it Yourself »< and &. Always escape < and & when they appear in normal text, especially when showing code examples on a page.Non-breaking spaces
A normal space allows the browser to wrap the line there. A non-breaking space ( ) keeps the words on either side together on one line. Use it for things that look wrong when split, such as amounts and units.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Non-breaking Space</title>
<style>
p { width: 160px; border: 1px solid #ccc; padding: 4px; }
</style>
</head>
<body>
<p>The total price of the new phone is KSh 24,999 only.</p>
<p>The total price of the new phone is KSh 24,999 only.</p>
</body>
</html>Try it Yourself »In the first box, "KSh" and the amount always stay together.
to push text sideways or indent it. Use CSS margin or padding for spacing.Symbols
Entities also exist for many symbols. With a UTF-8 page you can usually type these directly, but entities are handy when your keyboard cannot.
| Symbol | Entity | Meaning |
|---|---|---|
| © | © | Copyright |
| ® | ® | Registered trademark |
| ™ | ™ | Trademark |
| € | € | Euro |
| £ | £ | Pound |
| ° | ° | Degree |
| × | × | Multiplication |
| ÷ | ÷ | Division |
| → | → | Right arrow |
| — | — | Em dash |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Symbols</title>
</head>
<body>
<p>Temperature in Lodwar today: 38°C</p>
<p>Room size: 4 × 5 metres</p>
<p>Next step → pay the deposit</p>
<footer>© 2026 Skope Digital Academy</footer>
</body>
</html>Try it Yourself »Emojis
Emojis are ordinary characters in the Unicode standard. As long as your page has <meta charset="UTF-8">, you can paste them straight into your HTML. You can also write them with their number in hexadecimal.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Emojis</title>
<style>
.big { font-size: 40px; }
</style>
</head>
<body>
<p class="big">🦁 🐘 🦒</p>
<p>Typed directly: 🇰🇪 ☀️ ☕</p>
<p>Safari animals: lion, elephant and giraffe.</p>
</body>
</html>Try it Yourself »Emojis look slightly different on Android, iPhone and Windows, because each system draws them with its own font.
Show the less-than and greater-than signs as text.
<p>Use h1 for main headings.</p>lt means "less than" and gt means "greater than". Do not forget the & and ;.
Write the company name with an escaped ampersand.
<p>Wekesa Daughters</p>The entity name is short for "ampersand".
SKOPE