Why this matters
Screen readers use the language attribute to select the correct pronunciation engine. Without it, an English screen reader might try to pronounce French text with English phonetics, making it incomprehensible.
Common failures
These are the most frequent ways this criterion is violated in real-world websites:
- Missing lang attribute on <html> element
- Incorrect language code (e.g. lang='english' instead of lang='en')
- Language not matching the actual page content
How to fix
- Add the lang attribute to the html element: <html lang='en'>
- Use valid BCP 47 language tags: en, es, fr, de, ja, zh, etc.
- For pages with mixed languages, set the primary language on <html> and use lang on specific elements
Related axe-core rules
xsbl uses axe-core to automatically detect violations of this criterion. The following rules are checked:
Check your site for 3.1.1 violations
xsbl scans your rendered pages in a real browser and finds violations of this criterion automatically.
Scan your site freeOfficial reference: Understanding WCAG 3.1.1: Language of Page (W3C)