Language & reading
The Page's `lang` and `xml:lang` Name Different Languages
The page tells software two different languages, so a screen reader may guess wrong and read every word with the wrong accent and rules.
html-xml-lang-mismatchWCAG 2.0Introduced in WCAG 2.0.Level AA — the minimum. Missing it blocks people outright.
- Status
- ModerateModerate — An annoyance, with a workaround.CurrentScanners run this rule today.
- Owner
- DevContentTest
- Audit
- AutomatedA scanner finds it, and a clean scan means it's fixed.
Why it matters
Screen readers use the page's language setting to pick a voice and how to say words. Translation tools and spell checkers use it too.
When lang and xml:lang disagree, different software may pick different languages. English read with a Spanish voice can be very hard to understand.
Who it affects
| Who | What they experience | Impact |
|---|---|---|
| Screen reader users | They may hear the whole page read in the wrong accent, with words mispronounced or garbled. | High impact |
| Low-vision users (magnification) | Affected only if they use a screen reader or read-aloud tool. | Partial impact |
| Cognitive and neurodivergent users | Those who use read-aloud tools may hear confusing speech that is hard to follow. | Partial impact |
Business & product impact
| Area | Why | Impact |
|---|---|---|
| Legal | It relates to WCAG 3.1.1 Language of Page at Level A, part of WCAG 2.2 Level AA and EN 301 549. Complaints under Australia's Disability Discrimination Act point to WCAG. | Moderate impact |
| SEO | Search engines rely on other signals for language. Don't sell this as a search win. | Low impact |
| Brand trust | A page read in the wrong voice sounds broken to screen reader users. | Low impact |
| Cost to fix | Usually a one-line fix in the page template. Fix it once and every page is fixed. | High impact |
Fixing it in code
Make both attributes match
Don't
<html lang="en" xml:lang="fr">A screen reader says: “The page may be read with a French voice, mispronouncing the English text.”
Do
<html lang="en" xml:lang="en">A screen reader says: “The page is read with an English voice.”
Both attributes now name the same language, so all software agrees.
Or drop `xml:lang` on ordinary web pages
Don't
<html lang="en-AU" xml:lang="de">A screen reader says: “Software may pick German or English, depending on which attribute it reads.”
Do
<html lang="en-AU">A screen reader says: “The page is read with an English voice.”
Normal HTML pages only need lang, so there's nothing left to disagree.
Designer's handoff note
Note the main language of each page in the design spec, so developers set it correctly.
For translated sites, check that each language version sets its own language.
Quick test
Tool
Browser developer tools (opens in a new tab) (free in every browser)
Checklist
- Pass
- There is no `xml:lang`, or both start with the same language code, like `en`.
- Fail
- The two values name different languages, like `en` and `fr`.
Check these at the same time
- The page doesn't say what language it's in
html-has-lang
What a green scan still misses
A scanner checks that the two attributes agree. It can't tell whether that language is actually the one the page is written in.
Reference
- Rule ID
html-xml-lang-mismatch- Raised by
- axe-core: “HTML elements with lang and xml:lang must have the same base language”
- WCAG
- 3.1.1 Language of Page (opens in a new tab) · Level A · since WCAG 2.0
- Other standards
- EN 301 549 9.3.1.1 · RGAA 8.3.1
- Last reviewed
- 14 October 2026