Understandable · 3.1 Readable

Language of Page WCAG 3.1.1 · Level A

The default human language of each page must be programmatically determinable, which in HTML usually means a correct language code in the lang attribute of the html element. Passages in other languages are covered separately by 3.1.2.

Level
A
Since
WCAG 2.0
Principle
Understandable
Guideline
3.1 Readable

Live demo

Listen to a French page declared two ways

The same task, done two ways: switch between the version that passes and the one that fails, or put them side by side. Everything in the box is live, so try it with a keyboard, a pointer or a screen reader.

Press Listen in each version and compare the voice. The log shows which language the voice used.

Live example

Passes

The box below stands for a whole page from a library website in Lyon. All of its text is in French.

Horaires d'ouverture

La médiathèque est ouverte du mardi au samedi, de dix heures à dix-huit heures.

L'inscription est gratuite pour tous les habitants de la ville.

What happened

    Why it passes

    The page declares French with lang="fr", so the speech uses a French voice and the words sound the way a French reader expects.

    Why it fails

    The page declares English with lang="en" although the text is French, so an English voice reads it with English rules and many words become hard to recognize.

    Examples

    Code that fails, and the fix

    Five examples, each one running: the usual ways this criterion fails, and code that passes. Listen to them, measure them, or copy the code.

    01What changes + lang="en"

    Fails

    Page with no language declared

    Live preview

    HTML
    <!DOCTYPE html><html><head>  <meta charset="utf-8">  <title>Your order is confirmed - Northfield Books</title></head><body>  <p>Your package will arrive on Thursday.</p></body></html>

    The html element has no lang attribute, so software has to guess the language. A screen reader set to another language may read the whole page with the wrong voice.

    Passes

    Language set on the html element

    Live preview

    HTML
    <!DOCTYPE html><html lang="en"><head>  <meta charset="utf-8">  <title>Your order is confirmed - Northfield Books</title></head><body>  <p>Your package will arrive on Thursday.</p></body></html>

    lang="en" is a valid language code for English, so screen readers pick an English voice and browsers know which language to translate from. This is technique H57.

    02What changes − "en" + "fr"

    Fails

    Shared template declares English on a French page

    Live preview

    HTML
    <html lang="en"><head>  <meta charset="utf-8">  <title>Votre commande est confirmée</title></head><body>  <p>Votre colis arrivera jeudi.</p></body></html>

    A language is declared, but it is the wrong one. Screen readers read the French text with English pronunciation rules, which makes it hard to understand.

    Passes

    Each language version declares its own code

    Live preview

    HTML
    <html lang="fr"><head>  <meta charset="utf-8">  <title>Votre commande est confirmée</title></head><body>  <p>Votre colis arrivera jeudi.</p></body></html>

    The French version declares lang="fr", so the screen reader switches to a French voice. A regional code such as fr-CA is also valid when the variant matters.

    Fails

    Made-up language code

    Live preview

    HTML
    <html lang="english"><head>  <title>Your order is confirmed - Northfield Books</title></head>

    "english" is not a registered language subtag, so the language still cannot be determined. Use a code from the IANA Language Subtag Registry, such as en.

    Why it matters

    Who it helps

    Screen readers and text-to-speech tools use the declared language to pick the right voice and pronunciation rules, and browsers use it for translation and display. Without it, blind users and people who listen to text for reading support may hear garbled speech.

    W3C: Understanding 3.1.1
    • Level A

      Level A is the minimum: failing it can shut some people out completely.

    • In WCAG versions

      Part of WCAG 2.0 since December 2008, and of every version after it.

      WCAG 1.0 checkpoints: 4.3

    • Where it is required

      Required where the law names WCAG 2.0 or later at this level: the United States, Canada, the European Union, the United Kingdom, France, Germany, Italy, Spain, the Netherlands, Ireland, Norway, Switzerland, India, Japan, Australia, New Zealand and Israel.

    How to test

    Checking it

    A few concrete steps. Automated tools find some failures; most need a person.

    1. Inspect the html element and confirm it has a lang attribute.
    2. Check that the language code is valid, such as en or fr-CA, and matches the main language of the page content.
    3. Listen to the page with a screen reader and confirm it is read in the correct language voice.

    Common failures

    Where it breaks

    • The html element has no lang attribute.
    • The lang attribute is empty or holds an invalid or made-up language code.
    • A shared template sets lang to en on pages whose content is written in another language.