Language of Page
Declare the page’s language in the markup. It is what tells a screen reader which voice and pronunciation rules to use, and what lets a browser offer to translate.
- Principle
- Understandable
- Guideline
- 3.1
- Level
- A
- In WCAG since
- 2.0
- Number
- 3.1.1
Broken, then fixed
The same interface twice: first with the mistake, then with the smallest change that fixes it.
No language declared.
The screen reader falls back to whatever the user’s system says. English read with German pronunciation rules is not slightly harder to follow — it is unintelligible.
One attribute.
Use the real subtag for the content — en-GB and en-US differ in more than spelling once a voice is reading them aloud.
What changed in the code
The fix as a diff: removed lines are marked with a minus, added lines with a plus.
removed: <html>
added: <html lang="en">
The cheapest criterion in the standard, and among the most often missed.
How to test
Check your own interface against 3.1.1, one step at a time.
- Open the page, right-click and choose View Page Source. Find the opening html element and check that it has a lang attribute.
- Check that the value is a real language code for the language of the page, such as en for English or fr for French. An empty value, or a word such as english, does not count.
- Read the page and work out which language most of its text is in. Check that lang names that language; when two languages share the page equally, it names the one that comes first.
- Run a free checker such as axe DevTools or the W3C Nu Html Checker and look for a missing or invalid lang attribute. Repeat on each page template the site uses.
- Turn on a screen reader (NVDA on Windows, VoiceOver on a Mac) and read the first paragraph. Listen for the right voice and accent; English read with a French accent means lang is missing or wrong.
Common questions
Does 3.1.1 need a region code such as en-GB?
No. The language code on its own, such as en, is enough to pass. A region code such as en-GB can still help a screen reader choose the right accent.
Does a page in two languages pass 3.1.1?
Yes, when the html element declares the language most of the text is in. If both are used about equally, declare the one that comes first, and mark passages in the other with their own lang attribute for 3.1.2 Language of Parts.
Does 3.1.1 apply to a single-page app?
Yes. An app at one address counts as one page, so its html element needs a lang attribute like any other page. If the app switches its whole interface to another language, change lang to match.
Try it yourself
A lab is a small working piece of interface that you change yourself. Read its steps, use the controls under it, and watch the verdict line at the bottom: it says whether the criterion passes or fails as you go. Reset puts it back.
Try it: declare the page’s language
How to use this lab
- Goal. Make a screen reader read an English page in an English voice.
- The controls. The options under “The page’s lang attribute” set the lang attribute on the mock page: None, lang="en" or lang="fr". The markup shows the tag you made, and the log names the voice each line is read in. The reader’s screen reader is set to German.
- Try this. Choose None, then lang="fr", then lang="en", and watch the voice change in the log.
- What it means. With lang="en", 3.1.1 passes: the screen reader picks an English voice for English text. With None it falls back to German, and with lang="fr" it uses French, so 3.1.1 fails and listeners hear English words pronounced wrongly. The verdict line under the lab says which.
The page is in English. The reader’s screen reader is set to German.
The markup
<html>Screen reader says
3.1.1 fails
Also in guideline 3.1
Criteria in the same guideline often fail together.