</>
ValidateHTML

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

Inaccessible
<!-- No lang attribute -->
<html>
<head>...</head>

<!-- Wrong: lang on body instead of html -->
<html>
<body lang="en">
Accessible
<!-- 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?
Screen readers fall back to the user's default voice, so a French page may be read with English pronunciation rules and become incomprehensible. It is a WCAG 2.1 Level A failure even though nothing looks wrong on screen.
Should I use lang="en" or lang="en-US"?
Use the simple primary code (en, fr, de) unless a regional variant matters for pronunciation, spelling, or currency. en-US and en-GB are valid when the distinction is meaningful, but plain en is sufficient for most sites.
How do I handle a page with content in multiple languages?
Set the main language on the <html> element, then add a lang attribute to any element containing a different language, for example <span lang="fr">. The screen reader switches pronunciation engines for just that passage.

Check Your Accessibility Now

Our accessibility checker detects this issue automatically.

Open Accessibility Checker
Recommended

Cloudways · 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

Start free trial

Related Accessibility Errors

View all accessibility errors