When users configure a screen reader, they select a default language. If a web page does not clearly declare its language or declares it incorrectly, the screen reader falls back to that default.
This means:
- Words may be pronounced using the wrong accent or phonetic rules
- Entire sentences can sound garbled or unintelligible
- Language switching within a page does not occur
For example, if a page written in Spanish is marked as lang="en", screen readers such as NVDA, JAWS, and VoiceOver will attempt to read Spanish words using English pronunciation rules. The result is often confusing even for fluent speakers.
What a “Valid Language Value” Means
The value of the lang attribute must be a standardised language tag defined by BCP 47 (an IETF specification).
What is BCP 47?
BCP 47 is a standardised system for naming human languages in a way that software understands. It prevents ambiguity, for example, distinguishing British English from American English, so assistive technologies can apply the correct pronunciation rules and speech voice.
Examples of valid language values:
en— Englishen-US— American Englishfr-CA— Canadian Frenches— Spanish
Examples of invalid values:
english(not standardised)uk(country code, not a language)en_US(incorrect format)- Misspelt or invented codes
Language tags are case-insensitive, but they must use valid subtags in the correct format.
WCAG Success Criteria
3.1.1 Language of Page (Level A)
The default human language of each web page can be programmatically determined.
“Programmatically determined” means that software, such as screen readers, browsers, and translation tools, can reliably detect the language from markup, not by guessing.
Providing a lang attribute with an invalid value fails this requirement because the language cannot be determined with confidence.
How to Fix the Problem
Declare the primary language of the document using a valid language tag on the opening <html> element.
The primary language is the language used for most of the page’s readable content.
<html lang="en">
document text
</html>
Language Changes Within the Page
If part of the content is written in a different language, mark that change explicitly.
<p>
Text in one language
<span lang="es">texto en otro idioma</span>
</p>
Language values are inherited by child elements unless overridden. Inline language changes relate to WCAG 3.1.2 Language of Parts, which requires marking content that differs from the primary language.
Language vs Text Direction
Language and text direction are separate concepts. If a language is written right-to-left, direction must be specified explicitly using the dir attribute.
<p lang="ar" dir="rtl">Arabic text here</p>
The lang attribute does not imply text direction.
What Happens When lang Is Invalid or Missing
In practice, most screen readers:
- Trust the declared
langvalue - Do not reliably auto-detect language
- Do not always fall back gracefully when the value is invalid
As a result, a present but invalid value can produce worse output than leaving the language undefined, because assistive technologies may apply the wrong pronunciation rules without correction.
Common Mistakes
- Using non-standard language names (
lang="english") - Using country codes instead of language codes (
lang="uk") - Using underscores instead of hyphens (
en_US) - Misspelling language values
- Hard-coded CMS defaults that don’t match translated content
- Declaring the wrong language for localised pages
- Relying on automatic language detection
- Assuming ARIA can replace
lang(it cannot)
Standards Notes
langis an HTML attribute, not an ARIA feature- WCAG does not require automatic language detection; authors must declare it
- HTTP
Content-Languageheaders alone do not satisfy WCAG 3.1.1 - WCAG does not define precedence rules for conflicting language metadata; it requires authors to avoid ambiguity altogether
How to Test
- Inspect the opening
<html>element - Confirm a
langattribute is present - Verify the value is a valid BCP 47 language tag
- Ensure the declared language matches the visible content
- Check that inline language changes are marked where needed
Rule Description
The language specified in the lang attribute must be a valid, standardised language tag so assistive technologies can correctly determine how text should be pronounced and presented.
Wrapping Up
A lang attribute only works if its value is meaningful to software. Invalid language values leave assistive technologies guessing, resulting in broken pronunciation and reduced comprehension.
Using a valid language tag is a small markup change with a direct impact on clarity and usability, and it is required to meet WCAG 3.1.1.