HTML Emojis
Emojis like π, π and π look like small pictures, but to the browser they are just characters β exactly like the letter A or the digit 7. That means you can put them in headings, buttons, list items and even the page title without any image files.
Emojis are Unicode characters
Each emoji has a Unicode code point. The grinning face is U+1F600, the rocket is U+1F680. Because they are characters, you can:
- type or paste them directly into your HTML (with UTF-8 encoding),
- write them as numeric references, such as
😀or😀, - change their size with
font-size, just like text.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>Hello, emojis! π</h1>
<p>Pasted directly: π π π</p>
<p>Decimal references: 😀 🚀 🍕</p>
<p>Hex references: 😀 🚀 🍕</p>
</body>
</html>Note: The
<meta charset="UTF-8">line tells the browser how to decode the bytes of your file. Without it, a pasted emoji might turn into garbled characters likeΓ°ΕΈΛβ¬.
Emojis grow with font-size
Since an emoji is text, CSS text properties apply. font-size makes it bigger; color usually has no effect, because most emojis are drawn in full colour by the system's emoji font.
<style>
span { display: inline-block; margin: 4px; }
</style>
<span style="font-size:16px">π±</span>
<span style="font-size:32px">πΏ</span>
<span style="font-size:64px">π³</span>
<span style="font-size:96px">π²</span>Some useful code points
| Emoji | Name | Decimal | Hex |
|---|---|---|---|
| π | grinning face | 😀 |
😀 |
| β€οΈ | red heart | ❤ |
❤ |
| π | thumbs up | 👍 |
👍 |
| π | rocket | 🚀 |
🚀 |
| β | check mark button | ✅ |
✅ |
| β οΈ | warning | ⚠ |
⚠ |
| π | globe with meridians | 🌐 |
🌐 |
Combined emojis
Some emojis are made of several code points glued together:
- Skin tones: π followed by a modifier such as U+1F3FD gives ππ½.
- Zero Width Joiner (ZWJ) sequences: π© + U+200D + π» becomes a single π©βπ» "woman technologist".
- Flags: two "regional indicator" letters, such as π» + π³, become π»π³.
If a device does not know a combination, it shows the separate pieces side by side instead. This is a graceful fallback, so you do not have to worry about breaking the page.
<p style="font-size:40px">
👋🏽
👩‍💻
🇻🇳
</p>
<p>Wave + skin tone, woman + ZWJ + laptop, V + N flag letters.</p>Using emojis well
Emojis make interfaces friendly, but a screen reader reads them aloud by name ("rocket", "red heart"). A row of ten fire emojis becomes ten spoken words! Keep these guidelines in mind:
| Situation | Recommendation |
|---|---|
| Decorative emoji next to text | Hide it from screen readers with aria-hidden="true" |
| Emoji that carries meaning on its own | Wrap it in <span role="img" aria-label="..."> |
| Important information | Don't rely only on the emoji; add words too |
<style>
button { font-size: 18px; padding: 8px 14px; margin: 4px; }
</style>
<button><span aria-hidden="true">πΎ</span> Save</button>
<button><span aria-hidden="true">ποΈ</span> Delete</button>
<p>Status: <span role="img" aria-label="success">β
</span></p>
<p>Rating: <span role="img" aria-label="4 out of 5 stars">βββββ</span></p>Tip: On Windows press Win + ., on macOS press Ctrl + Cmd + Space to open the emoji picker and insert an emoji directly into your editor.
Test yourself
What is an emoji, from the browser's point of view?
- A tiny image file
- A Unicode character
- A special HTML tag
- A CSS icon
Which CSS property makes an emoji bigger?
widthzoom-emojifont-sizescale-text
How should you mark up a purely decorative emoji next to a button label?
- Add
aria-hidden="true"to it - Put it in an
<img>tag - Add
alttext - Use
<emoji>