Level A

17.1% of home pages are missing the lang attribute

3.1.1 Language of Page

In Plain Language

Every web page must declare its primary language using the lang attribute on the <html> element. This tells screen readers which language engine and pronunciation rules to use when reading the page aloud.

Without it, a screen reader may try to read French text with English pronunciation rules, making it incomprehensible.

Why It Matters

  • Screen readers use the lang attribute to switch between language-specific pronunciation engines -- without it, every word is mangled through the wrong rules.
  • Browsers use the language declaration for proper text rendering, including hyphenation, quotation marks, and font selection.
  • Translation tools rely on the lang attribute to detect the source language before offering translations.
  • This is a foundational requirement -- simple to implement but still missing on 13.5% of home pages surveyed.

Examples

Do: Declare the page language
Don't: Missing lang attribute

How to Fix It

  1. Add lang to the <html> element. Use a valid BCP 47 language subtag: en for English, es for Spanish, fr for French, zh for Chinese, etc.
  2. Be specific when needed. Use regional subtags like en-US vs en-GB when pronunciation differences matter for your content.
  3. Mark language changes inline. When a passage is in a different language than the page, use the lang attribute on the containing element: <span lang="fr">bonjour</span>.
  4. Avoid common mistakes. Do not use lang="javascript", lang="utf-8", or other invalid values. The attribute requires a valid language code, not a programming language or encoding.