- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML Emojis
Advanced HTML
HTML Emojis
Emojis are just characters, like letters. You can type or paste π straight into your HTML, or write it as a code like
😀. Either way, the browser draws it with the device's emoji font, which is why the same emoji looks different on an iPhone and on Windows.
Each emoji has a number in the Unicode standard. π is number 128512, which is 1F600 in hexadecimal. HTML lets you write that number as an entity.
Syntax
The same emoji, three ways
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Emoji codes</title>
</head>
<body>
<p>Typed directly: π</p>
<p>Hex code: 😀</p>
<p>Decimal code: 😀</p>
</body>
</html>All three lines show the same grinning face. The hex version starts with &#x, the decimal version with just &#, and both end with ;.
Typing emojis directly
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Emojis</title>
</head>
<body>
<h2>Using Emojis in HTML</h2>
<p>I love HTML π and CSS π¨!</p>
<p>Learning is fun πβ¨</p>
</body>
</html>This is the simplest way and works everywhere, as long as the page has <meta charset="UTF-8">. Without it, emojis can turn into strange characters like "Γ°ΕΈΛβ¬". On Windows, press Windows + . to open the emoji picker; on a Mac, Ctrl + Cmd + Space.
Common emoji codes
| Emoji | Name | Entity number | Hex entity |
|---|---|---|---|
| π | Grinning face | 😀 | 😀 |
| π | Face with tears of joy | 😂 | 😂 |
| π | Heart eyes | 😍 | 😍 |
| π | Cool face | 😎 | 😎 |
| π’ | Crying face | 😢 | 😢 |
| β€οΈ | Red heart | ❤ | ❤ |
| β | Star | ⭐ | ⭐ |
| π₯ | Fire | 🔥 | 🔥 |
| π | Rocket | 🚀 | 🚀 |
| β | Check mark | ✅ | ✅ |
| π‘ | Light bulb | 💡 | 💡 |
Emoji size
html
<p style="font-size: 24px; font-family: 'Segoe UI Emoji';">
HTML makes me π and CSS makes me π¨
</p>Emojis grow with font-size, like any text. Setting a font family such as Segoe UI Emoji only changes anything on Windows; other systems use their own emoji fonts.
Good to know
- Screen readers read emojis out by name, like "rocket". Three rockets in a row are read three times, so use them sparingly.
- Do not use an emoji alone as a button label. Add text, or an
aria-label. - Some emojis are made of several characters joined together, such as skin tones and family emojis, so one emoji can count as several characters in JavaScript.
- For other symbols like Β© and β, see HTML Entities & Symbols.
Browser Support
Chrome | Edge | Firefox | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
HTML Emojis exercises
Show an emoji
Write a paragraph that says To the moon π
Result
