Lesson 14 of 51 · Module 2, lesson 8 of 9 · 4 min
Special characters and emoji
Write characters like < and & safely, and add symbols and emoji to a page.
What you'll learn
- Which characters you must write in a special way in HTML
- How to write symbols such as ©, €, → and a non-breaking space
- How to add emoji to a page
Why this matters
The character < starts a tag. So what if you want to write "3 < 5" on your page? The browser may think a tag is starting. HTML has a way to write such characters safely, and the same system lets you add symbols that are not on your keyboard.
Character references
A character reference (often called an entity) is a short code that the browser turns into one character. It starts with & and ends with ;.
| You write | You see | Use it for |
|---|---|---|
< | < | A less-than sign in text |
> | > | A greater-than sign in text |
& | & | An ampersand ("and" sign) in text |
" | " | A double quote inside an attribute value |
| (a space) | A space that never breaks the line |
© | © | Copyright |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Special characters</title>
</head>
<body>
<h1>Salt & pepper</h1>
<p>Use less than 5 g of salt: amount < 5 g.</p>
<p>To start a heading, type <h1>.</p>
<p>Cook for 20 minutes.</p>
<p>© 2026 Home Kitchen</p>
</body>
</html>
What you'll see: "Salt & pepper", the less-than sign, the text <h1> written out, and ©.
Which ones do you really need?
Because your pages use UTF-8 (the <meta charset="UTF-8"> line), you can type almost any character directly: é, ñ, ü, ç, €, →, 中, ع. You only need references for:
<for<and&for&in text. (>is usually safe, but>is fine too.)"when a double quote appears inside a double-quoted attribute value.- Invisible characters such as
, which you cannot see when you type them.
The non-breaking space
is a space that the browser will not use to break a line. Use it between a number and its unit, so that "20" and "minutes" never end up on different lines: 20 minutes. Do not use it to make extra space — that is a job for CSS.
Numbers instead of names
Every character also has a number. You can write it as &# + number + ;. For example € is €, and → is →. You will see this in old pages, and it works for characters that have no name. With UTF-8, typing the character directly is usually clearer.
Emoji
Emoji are characters too, so you can type them directly — on Windows press Windows key + . (full stop), and on macOS press Control + Command + Space to open the emoji picker.
<p>Tomato soup 🍅 is ready! 🎉</p>
Emoji look different on different phones and computers, because each system draws its own. And a screen reader reads their name aloud ("tomato", "party popper"), so use them to add warmth, not to replace words.
Try it yourself
- Select the example above and choose Try it.
- Change
<to a plain<in "type <h1>". What happens to the page? - Add a line with an emoji and a euro price, such as
Soup: 4 €.
In step 2 the browser treats <h1> as a real heading, and the rest of the text becomes a big heading.
Common mistakes
- Writing
<in text. The browser may start a tag and hide text. Fix: write<. - Forgetting the semicolon, such as
©. It may work, or may not. Fix: always end with;. - Using many
to push text sideways. It breaks on small screens. Fix: use CSS for space. - Meaning only in emoji, such as "Oven ⚠️ 🔥". Some readers hear only "warning, fire". Fix: write the words: "Warning: the oven is hot."
Check yourself
- How do you write the text
<p>so that it shows on the page? - Why can you type é or € directly in your pages?
- What does
do?
Answers
<p>- Because the page uses UTF-8, which includes every character.
- It makes a space that never breaks the line.
Next: in this lesson you wrote <h1> to show code on a page. The next lesson shows the elements made for displaying code, keyboard keys and program output.

