Loading lessons...
HTML Character Set Reference
HTML Character Set Reference
A character set (charset) is the "alphabet" a browser uses to turn numbers into characters. Picking the right one makes every letter and emoji show up correctly.
The one you need: UTF-8
UTF-8 is the modern standard. It handles every language and every emoji. Always use it:
<meta charset="UTF-8">
Put it inside <head>, as early as possible.
Common character sets
| Charset | What it is | Still used? |
|---|---|---|
UTF-8 | All Unicode characters, web standard | Yes: use this! |
ASCII | 128 characters: letters, numbers, symbols | Legacy |
ISO-8859-1 | Latin-1: Western European | Legacy (was common) |
Windows-1252 | ANSI: Western European + extras | Legacy |
UTF-16 | Unicode, 2 bytes per character | Rare on the web |
GB2312 / GBK | Chinese | Some regions |
Shift_JIS | Japanese | Some regions |
EUC-KR | Korean | Some regions |
The history in one breath
- ASCII came first: 128 characters. No accents, no emojis.
- ANSI (Windows-1252) added European characters.
- Different regions got their own sets (Chinese, Japanese, Korean).
- Unicode arrived with a code for EVERY character in the world.
- UTF-8 is how Unicode is stored on the web. Winner!
What happens without a charset?
The browser has to guess. Guesses can be wrong, and you'll see gibberish like é instead of é. Setting <meta charset="UTF-8"> prevents this.
The UTF-8 character ranges
Unicode groups characters into ranges. A few famous ones:
| Range | Characters |
|---|---|
U+0000 - U+007F | ASCII (basic Latin) |
U+0080 - U+024F | Latin (accents: é, ñ, ü) |
U+0370 - U+03FF | Greek (α, β, π) |
U+0400 - U+04FF | Cyrillic (Russian, etc.) |
U+0600 - U+06FF | Arabic |
U+3040 - U+30FF | Japanese Hiragana and Katakana |
U+4E00 - U+9FFF | CJK Unified Ideographs (Chinese) |
U+1F600 - U+1F64F | Emoticons (emojis) |
U+2190 - U+21FF | Arrows |
You don't need to memorize these. They just show you how Unicode organizes the world's characters.
Entities are part of the story
When a character is hard to type (or has a special meaning), use an HTML entity:
< > & ©
Entities start with & and end with ;. See the HTML Entity Reference lesson for the full list!
TL;DR
- Always use
<meta charset="UTF-8">in the head. - UTF-8 covers every language and emoji.
- Old charsets (ASCII, ANSI, ISO-8859-1) can't show everything.
- Without a charset, characters can look like gibberish.
- Use entities for special characters that are hard to type.