Step 16 of 32

Telling browsers which language your pages use

By the end of this step: you will be able to check that each page names its language, and know when a few foreign words need their own label.

The short version

  • Every web page should say which human language it is written in.
  • Screen readers use this to pick the right way to speak the words.
  • It is one small line of code, and it is easy to check.
  • A few foreign words in a page can be labelled too.

Why the language matters

A person who is blind often uses a screen reader. That is a program that reads the page aloud. Different languages are spoken in different ways. If the page doesn't say which language it uses, the screen reader has to guess.

W3C says that when the language is named, screen readers can load the correct pronunciation rules.[1] Browsers can show characters correctly, and media players can show captions correctly.[1]

Two boxes. Left, labelled No language set: the screen reader has to guess and may sound wrong. Right, labelled Language set: the screen reader is told English and speaks it properly.
With the language named, a screen reader doesn't have to guess.

The rule in plain words

WCAG 3.1.1 Language of Page is Level A.[1] It says the default human language of each web page can be programmatically determined.[1] "Programmatically determined" just means a computer can find it in the code. Nobody has to guess.

The default language is the one most of the page is written in. For most small businesses, that is one language and the answer is easy.

How it looks in the code

You don't need to write code yourself. But it helps to know what you are looking for. W3C says to use a language attribute on the html tag to declare the default language of the text in the page.[2] An attribute is a label added to a piece of code. Here is W3C's own example for English:

A line of code in a box: html lang equals en. Below, a note says lang equals en means this page is in English, and every part of the page inherits it.
One short label on the html tag names the language of the whole page.

The lang="en" part is the label. The en stands for English. Every other element on the page inherits it, so one label covers the whole page.[2]

A few words in another language

Say your cafe page is in English, but the menu uses a French phrase. WCAG 3.1.2 Language of Parts is Level AA.[3] Its aim is to indicate when words are in a different language.[3]

Screen readers can use the pronunciation rules of the language of the text.[3] So a labelled French phrase is spoken like French, not read out as odd English.

W3C's advice is to add a language attribute to an element surrounding that content.[2]

There is a helpful exception. Proper names generally don't need a language label.[3] A proper name is the name of a person, a place or a brand.

A sentence in English with a French phrase, crème brûlée, marked as needing its own language label. A second sentence with a bakery brand name, marked as usually fine without a label.
Label foreign phrases. Proper names usually don't need it.

Try it on your site

  1. Open your home page in your browser.
  2. Right-click the page and choose View page source. A page of code opens.
  3. Look at the first few lines for <html lang=" followed by two letters.
  4. If you see it, and the letters match your page's language, that page is fine.
  5. If it is missing or wrong, ask your web designer or website builder's help team to fix it.
  6. Check one or two other pages too. Each page needs its own label, though most sites set it once for every page.

Sources

  1. Understanding Success Criterion 3.1.1: Language of Page, W3C Web Accessibility Initiative (accessed 2026-11-03)
  2. Declaring language in HTML, W3C Internationalization (accessed 2026-11-03)
  3. Understanding Success Criterion 3.1.2: Language of Parts, W3C Web Accessibility Initiative (accessed 2026-11-03)