MyInternships.in

HTML Basics

HTML Charsets

A character set, or charset, tells the browser how to turn the bytes in your file into readable letters and symbols. Declaring UTF-8 is a must for every modern page.


What is a Character Set?

Computers store text as numbers. A character set (charset) is the mapping between those numbers and the actual characters you see. If the browser guesses the wrong charset, text appears as strange symbols known as mojibake.

UTF-8 is the character set of the web. It can represent virtually every character from every language — English, Hindi, emoji, currency symbols — which is why nearly all pages use it.

Syntax

Declaring the charset in the head
Example
<meta charset="UTF-8">

Example: A Correctly Encoded Page

UTF-8 supports many languages at once
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Multilingual Page</title>
</head>
<body>
  <p>English: Hello</p>
  <p>Hindi: नमस्ते</p>
  <p>Japanese: こんにちは</p>
  <p>Emoji: 🎉 💻 🚀</p>
</body>
</html>

More Examples

Currency and accented characters render correctly
Example
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"></head>
<body>
  <p>Prices: ₹499, €10, £8, ¥1000</p>
  <p>Names: José, Zoë, François</p>
</body>
</html>

Charset Facts

ItemDetail
Recommended charsetUTF-8
Where to declare itFirst thing inside <head>
Characters supportedAll Unicode: every language plus emoji
If omittedBrowser may guess wrong and show garbled text
💡

Put <meta charset="UTF-8"> as the very first element inside <head>, before the title. The browser must know the encoding before it reads the text.

⚠️

Also make sure your editor saves the file itself as UTF-8. Declaring UTF-8 but saving in another encoding still produces garbled characters.

Key Takeaways

  • A charset maps stored numbers to visible characters.
  • UTF-8 supports every language and emoji, and is the web standard.
  • Declare it with <meta charset="UTF-8"> at the top of <head>.
  • Save your file as UTF-8 too, or text may still break.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships