ASWCode Tutorials

Learn Web Development - From Basics to Advanced

HTML Encoding (Character Sets)

HTML Encoding is a way to tell the browser how to read the text on your webpage. It ensures that special characters, emojis, and symbols display correctly.

1. What is a Character Set?

A character set (charset) is a list of characters that a webpage can display. Examples:

2. How to Set Character Encoding in HTML

Use the <meta> tag inside the <head> section:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>My Website</title>
</head>
<body>
  <p>Hello World! 🌍</p>
</body>
</html>

Hello World! 🌍

3. Why Use UTF-8?

4. Example of Incorrect Encoding

If you don’t use proper encoding, special characters may appear as broken symbols:

Some characters may appear like this: � � �

Next Lesson → HTML vs XHTML

Previous Lesson → Using Emojis in HTML

← Back