ADA Title II Deadline: April 24, 2026

Language Attribute Accessibility Checker

WCAG 3.1.1 requires every page to declare its language in the HTML. Missing lang attributes cause screen readers to mispronounce content — found on 17% of home pages.

No signup required. Results in under 60 seconds.

WCAG 2.1 AAAI Fix SuggestionsFree, No Signup

What WCAG 3.1.1 and 3.1.2 Require

WCAG 3.1.1 (Language of Page, Level A) requires that the default human language of each web page can be programmatically determined. This is done with the lang attribute on the <html> element. WCAG 3.1.2 (Language of Parts, Level AA) requires that the language of each passage or phrase can be programmatically determined when it differs from the page's default language. These criteria directly affect screen reader pronunciation. When a page declares lang="en", screen readers use English pronunciation rules. Without this declaration, the screen reader guesses — often incorrectly, especially on multilingual pages. The WebAIM Million study finds 17% of home pages lack a valid language attribute. It is one of the simplest WCAG criteria to fix — a single attribute addition.

Why Language Declaration Matters

The lang attribute affects multiple aspects of the user experience:

  • Screen reader pronunciation: A screen reader set to English encountering French text without lang="fr" will attempt to read it with English phonetics — "bonjour" becomes something unintelligible. Proper lang attributes trigger the correct speech synthesizer
  • Braille displays: Braille translation tables differ between languages. Without the correct lang attribute, braille output may be incorrect
  • Browser translation: Google Translate and browser auto-translate features use the lang attribute to determine the source language and offer translation
  • CSS language-specific styling: The :lang() CSS pseudo-class allows language-specific typography — different quote marks, hyphenation rules, and font choices
  • Search engines: The lang attribute helps search engines serve the correct page to users searching in that language

Implementation and Code Examples

Implementing language attributes correctly:

  • Page language: <html lang="en"> for English, <html lang="es"> for Spanish, <html lang="de"> for German. Use valid IANA language subtags
  • Regional variants: <html lang="en-US"> or <html lang="pt-BR"> — include the region subtag when pronunciation differs significantly between regional variants
  • Inline language changes: <p>The French word <span lang="fr">accessibilité</span> means accessibility.</p>
  • Multilingual navigation: <nav><a href="/en" lang="en">English</a> <a href="/de" lang="de">Deutsch</a> <a href="/ja" lang="ja">日本語</a></nav>
  • Common mistakes: Using lang="english" instead of lang="en" (must be IANA subtag), setting lang on <body> instead of <html>, or omitting lang entirely from HTML templates

How CompliScan Detects Language Issues

CompliScan checks for: missing lang attribute on the <html> element, empty lang attributes, invalid language codes (codes not in the IANA registry), and lang attributes that do not match the actual page content language. Each violation is flagged with the specific issue and an AI-generated fix — typically a one-line HTML change. The language attribute check is fully automatable and CompliScan catches it with near-100% accuracy. For WCAG 3.1.2 (language of parts), automated detection is limited — the scanner can identify elements with lang attributes that have invalid codes, but detecting text that should have a lang attribute but does not requires manual review of multilingual content. This is one of the quickest accessibility wins — fix it in seconds, comply immediately. Meets requirements for the European Accessibility Act, ADA Title II deadline of April 24, 2026, and all other WCAG-referencing legislation.

Frequently Asked Questions

Where should the lang attribute go?

The lang attribute must be on the <html> element for WCAG 3.1.1 compliance: <html lang='en'>. This sets the default language for the entire page. For content in a different language (WCAG 3.1.2), add lang to the enclosing element: <span lang='fr'>Bonjour</span>. Do not put the page language on <body> — it must be on <html> for screen readers and browsers to detect it reliably.

What language code format should I use?

Use IANA language subtags, which follow the BCP 47 standard. The primary language is a 2-letter code: 'en' for English, 'fr' for French, 'de' for German, 'ja' for Japanese. Add a region subtag when relevant: 'en-US' for American English, 'pt-BR' for Brazilian Portuguese. Never use full language names ('english') or other non-standard codes. The IANA Language Subtag Registry is the authoritative source.

Do I need lang attributes for code snippets?

Code snippets in programming languages do not need lang attributes — the lang attribute is for human languages, not programming languages. However, if you have explanatory text in a different human language alongside code (e.g., Japanese comments in an English-language page), that text should have a lang attribute. The code itself can remain unmarked.

Does the lang attribute affect text-to-speech for all users?

The lang attribute primarily affects screen readers and browser text-to-speech features. It does not affect visual rendering for sighted users. However, it does influence browser translation services, CSS hyphenation, and spell-checking — all of which affect the general user experience. Setting the correct lang attribute is a zero-downside improvement that takes seconds to implement.

Check Your Website Now

Enter your URL below and get a free accessibility report with AI-powered fix suggestions in under 60 seconds.

No signup required. Results in under 60 seconds.