To display an HTML page correctly, a web browser must know which character set (encoding) was used to write the page. Without the correct charset, special characters may appear as strange symbols or question marks.
Computers store text as numbers (bytes). A character encoding is a mapping between those numbers and actual characters (letters, digits, symbols).
For example, in ASCII:
65 → A66 → B97 → a48 → 0Always specify the character encoding near the top of your HTML <head>:
<meta charset="UTF-8">
<meta charset> tag, browsers may guess the encoding incorrectly, causing characters like é, ñ, ü, € to display as garbled text.
ASCII (American Standard Code for Information Interchange) was the first character encoding standard. It defined 128 characters using 7-bit numbers (0–127):
ASCII only supports English and has no support for accented letters, foreign scripts, or symbols.
ANSI (Windows-1252) extended ASCII to support 256 characters — adding accented Western European letters like é, ñ, ü. It was the default charset in older Windows HTML editors.
| Charset | Characters | Languages Supported |
|---|---|---|
| ASCII | 128 | English only |
| ANSI (Windows-1252) | 256 | Western European languages |
| ISO-8859-1 | 256 | Western European languages |
| UTF-8 | 1,112,064+ | All languages, symbols, emojis |
UTF-8 (Unicode Transformation Format — 8-bit) is the recommended charset for all HTML pages. It covers:
UTF-8 for all your HTML pages. It is the default encoding for HTML5 and supported by every modern browser and device in the world.
Here is the recommended complete head section for any HTML5 page with proper charset:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
</head>
<body>
<p>Hello World — supports all characters: é ñ ü 😀 € مرحبا</p>
</body>
</html>
| Decimal | Character | Decimal | Character | Decimal | Character |
|---|---|---|---|---|---|
| 32 | (space) | 65 | A | 97 | a |
| 33 | ! | 66 | B | 98 | b |
| 34 | " | 67 | C | 99 | c |
| 35 | # | 68 | D | 100 | d |
| 36 | $ | 69 | E | 101 | e |
| 37 | % | 70 | F | 102 | f |
| 38 | & | 71 | G | 103 | g |
| 39 | ' | 72 | H | 104 | h |
| 40 | ( | 73 | I | 105 | i |
| 41 | ) | 74 | J | 106 | j |
| 48 | 0 | 75 | K | 107 | k |
| 49 | 1 | 76 | L | 108 | l |
| 50 | 2 | 77 | M | 109 | m |
| 51 | 3 | 90 | Z | 122 | z |