Character Sets in HTML
? Character Sets in HTML
A character set (or charset) in HTML defines the encoding used to display characters on a web page, like letters, numbers, symbols, and special characters.
Why is Character Set Important?
Ensures text displays correctly in all browsers and devices
Supports different languages, symbols, and emojis
Avoids garbled or unreadable characters
Common Character Sets
UTF-8 Most popular and recommended; supports virtually all characters from all languages
ISO-8859-1 (Latin-1) Older standard mostly for Western European languages
ASCII Basic English characters only
How to Specify Character Set in HTML
Add a <meta> tag inside the <head> section:
<meta charset="UTF-8">This tells the browser to use UTF-8 encoding.
Example of Complete HTML with Charset
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Example Page</title></head><body> <p>Hello, world! ?</p></body></html>How to Check or Change Charset in HTML
Always add the charset meta tag as early as possible in the
<head>Ensure your text editor saves files in UTF-8 encoding
If you see weird characters (like ? or ?), its likely a charset mismatch
Summary
| Charset | Description | Use Case |
|---|---|---|
UTF-8 | Universal, supports all languages | Recommended for all modern pages |
ISO-8859-1 | Western European characters only | Legacy projects |
ASCII | Basic English characters | Very old/simple text |
Need help adding special characters (like accented letters or symbols) using HTML entities too?