Language of Page: Declare the Default Language
Also called: Page language, Default language, Document language, html lang
Definition
Language of Page is WCAG success criterion 3.1.1. It requires that the default human language of each web page can be programmatically determined – in HTML through the lang attribute on the html element.
Language of Page is the WCAG rule that every web page must declare its main language in code. Browsers, translation tools and a screen reader read that declaration to choose pronunciation rules, fonts and hyphenation. Without it, a German page can be read aloud with English pronunciation – understandable to nobody.
What it means
WCAG 3.1.1 Language of Page is a Level A criterion of WCAG 2.2: "The default human language of each web page can be programmatically determined." In HTML, the sufficient technique is H57 – the lang attribute on the html element. A language set in the HTTP header (SVR5) is only an advisory extra; screen readers rely on the attribute.
The default language is the one used most on the page. If several languages are used equally, W3C says the first one used counts. Single words or passages in another language are not part of 3.1.1 – they belong to criterion 3.1.2 Language of Parts.
W3C names these groups as the main beneficiaries:
| Who | What the declared page language does |
|---|---|
| Screen reader and text-to-speech users | The right pronunciation rules are loaded |
| People who find it hard to read fluently | Read-aloud tools speak the words correctly |
| People with cognitive, language and learning disabilities | Text-to-speech output stays understandable |
| Caption users | Media players display captions correctly |
Because 3.1.1 is part of the European standard EN 301 549 (clause 9.3.1.1), it also matters for the European Accessibility Act.
Examples
<!-- Good: English page, US English -->
<html lang="en-US">
<!-- Good: German page with an English quote -->
<html lang="de">
...
<p>Ihr Slogan: <span lang="en">Made for everyone</span></p>
<!-- Bad: no language declared -->
<html>
<!-- Bad: wrong language – the site is in Spanish -->
<html lang="en">The second example passes 3.1.1 because the page language is German; the lang="en" on the quote is what 3.1.2 asks for.
Set lang on the html element of every template – including error pages, checkout steps and pages generated by plugins. Use a valid BCP 47 tag such as en, en-GB, de or de-AT, and give every language version of a multilingual site its own value.
Copy one template with lang="en" across all language versions, leave the value empty, use a country code alone (at is not a language) or invent codes like english.
How to check the page language
Questions
What is the language of page in WCAG?
It is success criterion 3.1.1 at Level A. Each web page must declare its main human language in a way software can read – in HTML with the lang attribute on the html element.
Where do I set the page language in HTML?
On the opening html tag, for example <html lang="en">. Most CMS themes print it from the site's language setting, so check that setting first before you edit the template.
Should I use "en" or "en-US"?
Both are valid. The primary code (en) is enough for 3.1.1; a region (en-US, en-GB) helps when spelling or pronunciation differ between countries.
What if my page uses two languages?
Declare the one used most as the page language. Mark passages in the other language with their own lang attribute – that is criterion 3.1.2 Language of Parts.
Does the page language affect SEO?
Search engines mostly detect language from the content, but a correct lang attribute helps browsers offer translation and keeps the page consistent with its page title and heading structure for assistive technology.
Related terms
Missing Lang Attribute: Error Explained and Fixed
A missing lang attribute means the html element of a page has no lang attribute, or an empty or invalid one. Browsers and screen readers then cannot tell which language the page is written in.
Read definition: Missing Lang Attribute: Error Explained and FixedScreen Reader: How It Reads Websites and What It Needs
A screen reader is assistive software that reads the content and controls of a screen aloud or outputs them on a braille display. It relies on the names, roles and states that a website exposes through the browser's accessibility tree.
Read definition: Screen Reader: How It Reads Websites and What It NeedsPage Title: Write a Descriptive Title for Every Page
The page title is the text in a page's <title> element. Browsers show it in the tab, screen readers announce it first when the page loads, and it should describe the page's topic or purpose.
Read definition: Page Title: Write a Descriptive Title for Every PageHeading Structure: Build a Clear Page Outline
Heading structure is the outline a page forms through its h1 to h6 elements. Each heading marks the start of a section, and its level shows where that section sits in the hierarchy.
Read definition: Heading Structure: Build a Clear Page Outline