Page language
The language code must be valid
- Rule:
html-lang-valid - Severity: Serious
- WCAG level A
Why it matters
An invalid code ("german", "en_GB" with an underscore) is ignored, which leaves the page with no declared language at all.
How to fix it
- Use a valid BCP 47 tag: two-letter language, optional region after a hyphen ("en", "pt-BR").
- Do not put the language name, a locale with an underscore, or a country code alone.
In markup
<html lang="german"><html lang="de">The requirement behind it
This rule is one way of failing the following WCAG 2.2 success criteria. The W3C, which writes the standard, explains each of them:
- 3.1.1 Language of Page (opens in new tab) — WCAG level A
Further reading
Deque University on html-lang-valid (opens in new tab)
Deque maintains axe-core, the open-source engine our scanner runs. Their page documents the rule as the engine implements it.
Automated checks find failures a browser can prove. They cannot judge whether a caption is accurate, whether an alt text is useful, or whether a page can be operated end to end with a keyboard — those need a person.