Screen readers do not “understand” language the way humans do. They rely on explicit markup to know which pronunciation rules, grammar patterns, and speech synthesis voices to use. When the language of a page is not declared, or is declared incorrectly, assistive technologies must guess. That guess is often wrong.
The result is content that may be technically present, but practically unusable. To avoid this, every web page must explicitly declare its primary language using a valid lang attribute on the <html> element.
What the lang Attribute Does
The lang attribute tells software which language rules to apply when processing text.
This includes:
- How words are pronounced
- Which speech synthesis voice to use
- How text is presented in Braille
- How words are segmented for reading and navigation
A language tag is a standardised code that identifies a human language in a way software can reliably interpret.
For example:
en→ Englishen-US→ American Englishfr-CA→ Canadian French
These codes follow a standard called BCP 47, which exists so browsers, screen readers, and other tools all interpret language information consistently.
WCAG Success Criterion
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 and browsers, can reliably detect the language from markup, rather than guessing based on content.
To meet this requirement, authors must explicitly declare the page’s primary language.
What “Primary Language” Means
The primary language is the language used for most of the page’s readable content.
It does not mean:
- Every language that appears on the page
- Brand names or loanwords
- Isolated foreign phrases
Those cases are handled separately using inline lang attributes.
How to Fix the Problem
Declare the primary language on the opening <html> element using a valid language tag.
<html lang="en">
<!-- document head and body -->
</html>
This declaration applies to the entire document unless overridden.
Language Changes Within Content
If a portion of the content is written in a different language, mark that section explicitly.
<p>
Text in one language
<span lang="es">texto en otro idioma</span>
</p>
Language values are inherited by child elements unless a new lang value is specified.
Language vs Text Direction
Language and text direction are separate concerns.
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 alone does not imply direction.
What Screen Readers Do When lang Is Missing or Invalid
When no language is declared:
- Screen readers default to the user’s system language
- Pronunciation rules do not change automatically
- Voice switching is unreliable or does not occur at all
For example:
- Spanish text read with English pronunciation rules
- French content spoken using an English voice
- Mixed-language pages read entirely in one accent
Automatic language detection exists, but it is inconsistent and should not be relied on. WCAG requires authors to declare language explicitly to avoid this ambiguity.
Declaring the wrong language is often worse than declaring none, because it forces incorrect pronunciation consistently.
Common Mistakes
- Omitting the
langattribute entirely - Using an invalid value (e.g.
lang="english") - Declaring the wrong language for the page
- Setting lang on
<body>instead of<html> - Assuming screen readers auto-detect language reliably
- Using visual language indicators without programmatic markup
- Confusing
langwith HTTPContent-Languageheaders - Attempting to replace
langwith ARIA (ARIA does not apply here)
Standards Notes (Important Clarifications)
langis an HTML attribute, not an ARIA feature- HTTP headers alone do not satisfy WCAG 3.1.1
- Language tags are case-insensitive, but conventional casing improves consistency
- Subtags must be valid and registered (per BCP 47)
- WCAG applies to web pages, not fragments in isolation
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 language changes within content are marked where required
Rule Description
To meet WCAG 3.1.1, the language of the page must be explicitly declared using a valid lang attribute on the <html> element, so assistive technologies can reliably determine how the content should be presented.
Wrapping Up
WCAG 3.1.1 exists because language cannot be inferred reliably by software. Without explicit markup, assistive technologies guess, and guessing leads to broken pronunciation, reduced comprehension, and unusable content.
Declaring a valid lang attribute is one of the simplest accessibility fixes, but also one of the most critical. It turns text from technically present into actually understandable.