skip to content →
warningSEO RULE · R24

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·part of the 50-rule library

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

  1. 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").
  2. 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.
  3. Verify with axe DevTools. The "html-has-lang" rule should pass on every page.

Authoritative sources