HTML Charset
To display an HTML page correctly, a web browser must know the character set used in the page.
The HTML charset Attribute
The character set is specified in the `<meta>` tag:
<meta charset="UTF-8">
Character Sets
ASCII was the first character encoding standard (also called character set). It defines 128 different alphanumeric characters that could be used on the internet.
ANSI (Windows-1252) was the original Windows character set. It supported 256 different character codes.
ISO-8859-1 was the default character set for HTML 4. It also supported 256 different character codes.
UTF-8 is the default character encoding for HTML5. UTF-8 covers almost all of the characters and symbols in the world.
Difference Between Character Sets
The following table shows the differences between some character sets:
| Character Set | Description |
|---|---|
| ASCII | Uses 7 bits. 128 characters. Supports English letters A-Z, numbers 0-9, and some special characters. |
| ANSI | Uses 8 bits. 256 characters. Supports ASCII and Western European characters. |
| ISO-8859-1 | Uses 8 bits. 256 characters. Supports ASCII and Western European characters. |
| UTF-8 | Uses 8 to 32 bits. Millions of characters. Supports almost all languages and symbols in the world. |
Charset Example
Result