Missing Language Attribute
The lang attribute on the <html> element declares the primary language of the page content. Screen readers use this to switch to the correct pronunciation engine. Without it, a screen reader might try to read French content with English pronunciation rules, making it incomprehensible.
Why It Matters
Missing lang is a WCAG 2.1 Level A violation. Screen readers default to the user's system language, which may not match the page content. Search engines use the lang attribute to serve the correct language version in search results. It's one of the easiest accessibility fixes and has direct SEO benefits.
Common Causes
- Hand-writing the <html> tag or using a starter template that omits the lang attribute entirely.
- Putting lang on <body> or a wrapper <div> instead of the root <html> element, where it belongs.
- Leaving an English boilerplate lang="en" in place after translating the page into another language.
Code Examples
<!-- No lang attribute --> <html> <head>...</head> <!-- Wrong: lang on body instead of html --> <html> <body lang="en">
<!-- Correct: lang on html element --> <html lang="en"> <!-- For French content --> <html lang="fr"> <!-- For specific regional variant --> <html lang="en-US">
How to Fix
- 1Add lang="en" (or your language code) to the opening <html> tag.
- 2Use the correct ISO 639-1 language code: en, fr, de, es, ja, zh, etc.
- 3For mixed-language content, set the main language on <html> and use lang attributes on specific elements for other languages.
- 4If your site serves multiple languages, use different lang values on each language version.
Frequently Asked Questions
What happens if the lang attribute is missing?
Should I use lang="en" or lang="en-US"?
How do I handle a page with content in multiple languages?
Check Your Accessibility Now
Our accessibility checker detects this issue automatically.
Open Accessibility CheckerCloudways · Managed Cloud Hosting
Fix accessibility errors, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).
Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303
Related Accessibility Errors
Missing Alt Text on Images
Missing alt text hides images from screen readers and Google Images. Learn why alt attributes matter for accessibility and SEO, and how to write them well.
Skipped Heading Levels
A skipped heading level, like jumping H1 to H3, breaks your document hierarchy. Learn how to order headings correctly for screen readers and stronger SEO.
Missing Form Labels
Missing form labels leave inputs unreadable to screen readers and hurt usability. Learn how to label every form field correctly for WCAG compliance, step by step.