What this checks
The lang attribute tells browsers, screen readers and translation tools which language the page is in. The character set tells the browser how to turn bytes into letters; when it is wrong, accented letters turn into garbled symbols.
Google detects a page’s language from its visible content rather than from the lang attribute, so this check is mostly about readers and tools.
The 2 checks on this page
Each check has its own result in your report. “Learn more” in the report opens the matching card here.
PAGE-007HTML language declaration
Reads lang on the html element and checks that it is a real language code (ISO 639, two or three letters, with an optional region).
- Pass A valid language code
- Suggestion No lang attribute
- Problem An invalid value such as “english”
PAGE-009Character encoding declarations
When the HTTP header and the HTML both declare a charset, checks that they name the same encoding.
- Pass Consistent
- Problem Different encodings
- Not measured An unrecognized charset name
Examples
<html lang="es-MX">
<head><meta charset="utf-8">Content-Type: text/html; charset=iso-8859-1
<meta charset="utf-8">How to fix it
WordPress
Set the site language under Settings › General; the theme prints it in the html tag.
Next.js
Set lang on the html element in the root layout, per locale if the site is multilingual.
Nginx / Apache
Send charset=utf-8 in Content-Type, or omit it, and keep <meta charset="utf-8"> as the first element in head.
Check your fix
- View source and read the html tag and the first lines of head.
- Run curl -I and check the Content-Type header.
Questions
Does lang affect Google rankings?
Google says it detects language from visible content. lang still matters for screen readers and translation.
en-UK or en-GB?
en-GB. The region code for the United Kingdom is GB.
Sources
- W3C: Declaring language in HTML
- HTML standard: Specifying the document’s character encoding
- Google Search Central: Managing multi-regional and multilingual sites
