How accessible is your website?Start free check
WCAG 3.1.1Level AUnderstandable

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

Example
<!-- 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.

Do

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.

Don't

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.

    Let AI Handle Website Accessibility

    Built in Europe. Set up in 2 minutes, no developer needed. Put website accessibility on autopilot with AI-powered fixes and automated monitoring.

    1. 1Choose your plan
    2. 2Install in 2 min
    3. 3AI fixes your website
    4. Done