</>
ValidateHTML

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

❌ Invalid
<head>
  <title>My Page</title>
</head>
✓ Valid
<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?
As the first element inside <head>, within the first 1024 bytes of the document: <meta charset="UTF-8">. Declaring it early prevents the browser from re-parsing bytes it already read.
Why do my accented characters show as garbage?
That is mojibake, caused by an encoding mismatch. The browser is decoding UTF-8 bytes as a different charset (or vice versa). Declare UTF-8 and make sure the file is actually saved as UTF-8.
Is UTF-8 the right charset to use?
Yes. UTF-8 covers every language and emoji and is the web standard. There is no good reason to use legacy charsets like ISO-8859-1 in new pages.

Check Your HTML Now

Our validator detects this error automatically and shows the exact line number.

Open HTML Validator
Recommended

Cloudways · 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

Start free trial

Related HTML Errors

← View all HTML errors