Glossary · Code

Language attribute (lang)

Definition: The language attribute is the HTML attribute lang. It tells browsers and assistive technology which language a page or passage is written in – lang="en", for example. Screen readers choose their voice and pronunciation from it. WCAG 3.1.1 requires it for the page, and 3.1.2 for passages in another language [1][2].

German: Sprachauszeichnung · Last reviewed: 27 September 2026

Why one attribute matters so much

A screen reader reads English text with German pronunciation if the page is marked as German – or not marked at all on a system set to German. "Checkout" becomes something nobody would recognise. The language attribute also helps translation tools, CSS hyphenation and search engines.

What WCAG requires

  • 3.1.1 Language of Page (Level A): the main language of each page can be determined programmatically – in HTML through <html lang="…"> [1].
  • 3.1.2 Language of Parts (Level AA): when a section or sentence switches language, it is marked up. Proper names, technical terms, words of indeterminate language and words that have become part of the surrounding language are exempt – "kindergarten" in English text needs no lang of its own [2].

Common mistakes

  • No attribute at all, often in templates or on pages a CMS assembles.
  • The wrong value: a German page with lang="en" because the template came from an English theme.
  • Invalid codes, such as lang="english" instead of lang="en".
  • Language switches with no markup: a quotation in German, an "Auf Deutsch" link, or a product description in another language.

In code

<!-- No language: pronounced per system setting -->
<html>
<!-- Page in English, a quotation in German -->
<html lang="en">
  …
  <blockquote lang="de">
    Nichts über uns ohne uns.
  </blockquote>
  <a href="/de/" lang="de">Deutsch</a>

Valid values are BCP 47 language tags, such as en, de, en-GB or de-AT [3].

How Reviseberg handles it

Reviseberg uses axe-core to check that every page has a lang attribute with a valid value (rules html-has-lang, html-lang-valid, valid-lang). That settles WCAG 3.1.1 automatically. For 3.1.2, the check finds invalid values but not a foreign-language sentence with no markup at all. That is still a job for a person, so Reviseberg treats 3.1.2 as only partly testable by automation.

Screen reader · Braille display · Semantic HTML · Plain language

Further reading

Frequently asked questions

Which value is right for British English: en or en-GB?

Both are valid. en is enough for most pages; a region subtag such as en-GB is worth adding only when it really changes pronunciation or spelling.

Does every foreign word need marking up?

No. Proper names, technical terms and borrowed words are exempt. Mark up whole sentences, quotations and paragraphs in another language.

Does lang help with SEO?

Search engines usually detect the language themselves, and hreflang matters more for language versions of a page. For accessibility, though, lang is essential.

Sources

  1. W3C, WCAG 2.2, Success Criterion 3.1.1 Language of Page – https://www.w3.org/TR/WCAG22/#language-of-page
  2. W3C, WCAG 2.2, Success Criterion 3.1.2 Language of Parts – https://www.w3.org/TR/WCAG22/#language-of-parts
  3. W3C Internationalization, Language tags in HTML and XML – https://www.w3.org/International/articles/language-tags/

See what a scan finds on your site

One page in about thirty seconds, no email needed. The full report covers up to 100 pages and a keyboard journey.