Skip to main content

The WCAG Primer is intended for use by the UK cross government accessibility community.

3.1.1 Language of Page (A)

What WCAG says:

The default human language of each web page can be programmatically determined.

Understanding 3.1.1 Language of Page

What this means

A web page’s code must explicitly state what language it’s written in.

Why it matters

The page’s language can alter how text-to-speech software, such as screen readers, pronounces words.

It can also help in other areas, such as allowing search engines to provide results in a user’s own language.

How to check

Using your browser’s developer tools, check that the page’s <html> element has a lang attribute with the correct value.

The language value must be valid. Some examples of valid language values are:

  • cy – Welsh
  • en – English
  • en-GB – British English
  • en-US – American English
  • uk-Cyrl – Ukrainian written in Cyrillic script
  • uk-Latn – Ukrainian written in Latin script
  • en-Brai-GB – British English in Braille script

How to test in detail for 3.1.1 Language of Page

Good example

<html lang="en">
  <body>
    <h1>Hello world</h1>
  </body>
</html>

This passes because the lang attribute’s value matches the language of the page.

Common mistakes

No page language

<html>
  <body>
    <h1>Hello world</h1>
  </body>
</html>

This fails as the page’s lang attribute is missing.

Incorrect page language

<html lang="en">
  <body>
    <h1>Hola Mundo</h1>
  </body>
</html>

This fails as the lang attribute’s value does not match the language of the content.

Invalid page language

<html lang="English">
  <body>
    <h1>Hello world</h1>
  </body>
</html>

This fails as the lang attribute’s value is not valid.

The lang attribute does not necessarily have to match the language of the majority of the page, as long as each part of the page is correctly marked up to meet 3.1.2 Language of Parts (AA).

Useful resources