# Language of Page: Declare the Default Language

Source: https://allyway.ai/glossary/language-of-page

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](https://allyway.ai/glossary/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](https://www.w3.org/WAI/WCAG22/Understanding/language-of-page.html) is a Level A criterion of [WCAG 2.2](https://allyway.ai/regulations/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](https://allyway.ai/glossary/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 |

> **Note:** > **Language of Page vs. missing lang attribute**
> Language of Page is the requirement. "[Missing lang attribute](https://allyway.ai/glossary/missing-lang-attribute)" is the scanner error you see when a page breaks it – no `lang`, an empty value or a code that is not a real language tag.

Because 3.1.1 is part of the European standard [EN 301 549](https://allyway.ai/regulations/en-301-549) (clause 9.3.1.1), it also matters for the [European Accessibility Act](https://allyway.ai/regulations/eaa).

## Examples

```html title="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:** 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:** 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

Q: What is the language of page in WCAG?
A: 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.

Q: Where do I set the page language in HTML?
A: 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.

Q: Should I use "en" or "en-US"?
A: 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.

Q: What if my page uses two languages?
A: 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.

Q: Does the page language affect SEO?
A: 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](https://allyway.ai/glossary/page-title) and [heading structure](https://allyway.ai/glossary/heading-structure) for assistive technology.
