Missing html lang attribute: an accessibility and SEO must-have
The <html lang="en"> attribute tells screen readers what voice to use and translators what language to translate from. Missing it is a WCAG failure and an SEO weak signal. Add it to every page template.
The <html lang="en"> attribute tells screen readers what voice to use and translators what language to translate from. Missing it is a WCAG failure and an SEO weak signal. Add it to every page template. The lang attribute on the <html> element (e.g. <html lang="en-US">) declares the primary language of the page. Screen readers like NVDA and VoiceOver use it to pick the right phonetic engine; translators use it to detect the source language.
Last updated·
What it is
The lang attribute on the <html> element (e.g. <html lang="en-US">) declares the primary language of the page. Screen readers like NVDA and VoiceOver use it to pick the right phonetic engine; translators use it to detect the source language.
Why it matters
WCAG 2.1 lists it as a Level A requirement — a baseline accessibility failure. Search engines also lean on it for language detection when hreflang and visible content disagree. It's a one-line fix with zero downside.
How to fix it
- Set the attribute in your base template. <html lang="en"> for English; use the BCP 47 code matching the page language ("es", "de-AT", "zh-Hant").
- Override per-page for multi-language content. If a section of your site is in another language, override on those pages or use <span lang="..."> for inline blocks.
- Verify with axe DevTools. The "html-has-lang" rule should pass on every page.
Authoritative sources
- Google Search Central documentation — Google
- Schema.org vocabulary — schema.org
- SEO Starter Guide — Google Search Central
- MDN — HTML meta and link elements — Mozilla MDN