HTML validation · Head element

Charset not in the first 1,024 bytes

Over 1,024 bytes of comment come before the meta charset tag, so browsers may have to guess the encoding and reparse the page.

How this page is built

A long HTML comment at the top of the head pushes the <meta charset> tag past the first 1,024 bytes of the document.

The server also sends the encoding in its content type header, so the page still displays correctly here.

Why it matters

Browsers look for the character encoding in the first 1,024 bytes of a page. If they do not find it there, they may guess the encoding, start rendering, and then have to start again when they find the real one.

On pages without an encoding in the HTTP header, characters such as accented letters or symbols can appear garbled.

How to check it

View the source and check how far down the meta charset tag appears. The W3C Nu HTML Checker reports a charset declared too late. Check the content type response header for a charset as well.

How to fix it

Make the meta charset tag the first element in the head, before the title, comments, scripts or anything else. Also send the charset in the content type HTTP header.

Back to all tests