Charset Declaration Test
What is it?
The character encoding declaration tells the browser how to interpret the bytes in the HTML response. Without an explicit declaration, the browser must guess the encoding by sampling the document, and an incorrect guess produces garbled symbols, broken accented characters, and inconsistent rendering across devices. The fix is one short tag at the top of the document head.
Why charset still matters
Modern HTML standardizes on UTF-8, which can represent every character in every script in active use today. UTF-8 is the encoding Google recommends, the default in every modern build tool and content management system, and the only sensible choice for a new site. The Charset Declaration Test verifies that your page declares its encoding explicitly, which is the practice that produces consistent rendering across browsers, devices, and assistive technologies.
A missing or wrong charset declaration is the kind of bug that hides until it doesn't. The page may render fine in your local development environment, fine for English-speaking visitors, and only break when a user shares a quote with a curly apostrophe, a customer's name contains an accented character, or a translator adds non-Latin script. By that point the broken page may have been live for weeks.
Common mistakes worth checking
- Tag missing entirely, often on hand-coded templates or older CMS themes.
- Tag appears too late in the head: the declaration must be within the first 1024 bytes of the HTML or the browser may have already started decoding incorrectly.
- Conflicting Content-Type response header: when the HTTP header declares a different charset, the header wins. Both should agree on UTF-8.
- Document authored in a non-UTF-8 encoding: changing only the declaration without re-saving the file in UTF-8 will mangle the existing characters.
This test verifies that your page declares a character encoding correctly. The fix guide below shows the right tag to add, where it must appear in the document, and how to confirm that the server's response header agrees with the meta declaration.
Pass rate:
-
Top 100 websites: 96%This value indicates the percent of top 100 most visited websites in the US that pass this test (in the past 12 months).
-
All websites: 98%This value indicates the percent of all websites analyzed in SEO Site Checkup (500,000+) in the past 12 months.
| 2021 | 100% |
|---|---|
| 2022 | 98% |
| 2023 | 100% |
| 2024 | 96% |
100
75
50
25
0
How do I fix it?
The character encoding declaration tells the browser how to interpret the bytes in the HTML response. Without it, browsers must guess, which can produce garbled symbols, broken accented characters, and inconsistent rendering across devices. Fixing this issue means declaring UTF-8 as the very first element inside the page <head>.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example page</title>
</head>
Where to make the change
- Raw HTML: add
<meta charset="UTF-8">as the first child of<head>, before the title and any other meta tags. - WordPress, Shopify, Wix, Squarespace: all major CMS platforms emit the charset declaration automatically. If the test still fails, check for a custom theme that overrides the default head.
- Headless or framework sites: verify the base layout file includes the meta charset; most starter templates do.
Common causes and how to resolve them
- Tag is missing entirely: add
<meta charset="UTF-8">at the very top of the head. - Tag is present but appears too late in the head: the declaration must be within the first 1024 bytes of the HTML, otherwise the browser may have already started decoding incorrectly. Move the tag above any large inline content.
- Conflicting Content-Type header: if the HTTP response declares a different charset, the header wins. Update the server configuration so both agree on UTF-8.
- Legacy non-UTF-8 encoding: if the document was authored in ISO-8859-1 or Windows-1252, convert the file to UTF-8 in your editor; otherwise re-saving with the new declaration will mangle existing characters.
Best practices
- Always use UTF-8: it covers every script in active use and is the de-facto standard on the modern web.
- Declare the language too: a
langattribute on<html>helps screen readers, translation tools, and search engines correctly classify the content. - Configure the server: the response header (
Content-Type: text/html; charset=UTF-8) and the meta tag should agree. The header is the authoritative source.