Missing Charset Declaration
The charset declaration tells the browser how to decode the bytes of your HTML file into characters. Without it, the browser guesses, and may guess wrong, turning special characters (accents, emojis, symbols) into garbled text (mojibake).
Why It Matters
Missing charset can cause text to display incorrectly: accented characters (é, ñ, ü) show as garbage, emoji break, and currency symbols appear wrong. UTF-8 covers virtually all characters in all languages.
Common Causes
- Omitting the <meta charset> tag from the <head>.
- Saving the file in a non-UTF-8 encoding while declaring or assuming UTF-8.
- Placing the charset tag too late, after other content has already been parsed.
Code Examples
<head> <title>My Page</title> </head>
<head> <meta charset="UTF-8"> <title>My Page</title> </head>
How to Fix
- 1Add <meta charset="UTF-8"> as the first element inside <head>.
- 2It must appear within the first 1024 bytes of the document.
- 3Ensure your file is actually saved as UTF-8 (check your editor's encoding settings).
- 4UTF-8 is the only charset you should use in 2026. It supports all languages and emoji.
Frequently Asked Questions
Where should the charset declaration go?
Why do my accented characters show as garbage?
Is UTF-8 the right charset to use?
Check Your HTML Now
Our validator detects this error automatically and shows the exact line number.
Open HTML ValidatorCloudways · Managed Cloud Hosting
Fix this HTML error, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).
Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303
Related HTML Errors
Missing DOCTYPE Declaration
A missing DOCTYPE forces browsers into quirks mode, breaking your layout. Learn why <!DOCTYPE html> is required and how to fix inconsistent rendering fast.
Missing Lang Attribute
A missing lang attribute confuses screen readers and browser translation. Learn why the html lang attribute matters for accessibility and SEO, and how to add it.
Missing Viewport Meta Tag
Without a viewport meta tag, your site looks tiny on mobile even with perfect CSS. Learn the correct viewport configuration to fix responsive rendering fast.