HTML lang attribute
The HTML lang attribute is the language value set on the root <html> element of a page. It helps browsers, assistive technologies, and search engines understand the primary language of the content.
This is usually a low-severity field, but it is still useful to monitor, especially on international sites. A change here can signal a template edit, localisation issue, or incorrect language setting that affects accessibility and language targeting clarity.
What it is
The HTML lang attribute appears on the opening <html> tag, for example:
<html lang="en">
In this example, the page declares English as its primary language.
SEOlerts stores the exact value of that attribute and alerts you if it changes. That matters because even a small edit, such as changing en to en-gb or removing the value entirely, can alter how the page’s language is signalled.
Why it matters
The lang attribute helps define the main language of the page for browsers, screen readers, translation tools, and search engines.
For accessibility, it helps assistive technologies pronounce and interpret content correctly. For international SEO, it gives an additional language signal that can support the page’s wider regional and language setup.
It is not a replacement for hreflang, and it is not usually a major ranking lever on its own. But it is still an important structural signal, especially where pages are meant for different languages or markets.
What can go wrong if unchecked
If the HTML lang attribute changes unexpectedly, the page may start declaring the wrong language or stop declaring one clearly at all.
Common issues include:
- a page switching to the wrong language code
- a template update applying the same language value across all locales
- regional pages losing more specific language settings
- the attribute being removed or left blank
- development or fallback values going live
If this goes unnoticed, accessibility can suffer and international pages may send weaker or less accurate language signals. On multilingual sites, that can contribute to confusion between page versions.
Not every change is harmful. A move from en to en-gb may be a valid improvement if the page is specifically for a UK audience. The point is to confirm the new value matches the page’s purpose.
Why monitoring it matters
Monitoring the exact HTML lang attribute helps you catch language-setting changes that are easy to miss visually.
A page can still look completely normal to users while declaring the wrong language in the code. This is especially useful after template edits, CMS changes, localisation updates, international roll-outs, or rendering changes that affect the root HTML element.
Because the exact value is stored, you can see whether the page has changed language declaration completely or just shifted to a different variant.
What an alert may mean
An alert means the root <html lang> value is different from the previously stored value.
In practice, that could mean:
- the page’s primary language declaration was updated
- a template or CMS changed the default language output
- a locale-specific page is now using the wrong language code
- the attribute was removed, replaced, or generalised
- international or accessibility settings have changed
The alert does not automatically mean there is an SEO problem. It means the page is signalling a different primary language than before, and that should be checked against the intended setup.
What to check next
Start by confirming the current lang value in the page HTML.
Then review:
- whether the value matches the page’s actual language
- whether the code format is correct
- whether the change was intentional
- whether the issue affects one page or a wider template
- whether hreflang, canonical, and regional page settings still align with the new value
On international sites, also check whether the page’s language declaration still makes sense alongside its market targeting. A page can have technically valid hreflang but still carry an incorrect lang attribute.
Key takeaway
The HTML lang attribute declares the primary language of a page at code level. Monitoring it helps you catch template drift, localisation mistakes, and accessibility-related language changes that may not be obvious on the surface. An alert means the page’s language declaration has changed, and that change should be reviewed to confirm it is accurate and intentional.
