HTML5 Meta Charset & Encoding
HTML
What is character encoding?
Character encoding tells the browser how to interpret the bytes in your HTML file and turn them into readable characters (letters, symbols, etc.).
For example, should the byte 0x61
be shown as a
? Or something else?
Without proper encoding, special characters (like special characters é
, ü
, ₹
, €
, ✓
) might show up as weird symbols or question marks .
The HTML5 meta charset
In HTML5, we specify the character encoding using this meta tag inside <head>
:
Why use UTF-8?
Supports many languages at once. Handles special symbols, currency signs, emojis. Widely supported by browsers and servers. That’s why it’s the standard encoding for the modern web.
In HTML4 meta charset
you often saw a longer meta tag: