In short and in plain language
Every web page has a language. The language is written in the code of the page. A screen reader reads this. Then it says the words the right way.
If the language is missing, the text can sound wrong. If a German page says English in the code, an English voice reads the German text. That is hard to understand.
Sometimes a German page also has a sentence in English. For example, a slogan. This sentence also needs a language in the code. Then the screen reader reads it in English.
Names do not need a language. Words like newsletter do not need one either. People in Germany use these words a lot.
The button to switch language shows each language in its own words. So the link to English says English. To check it, you read the code. And you listen with a screen reader.
Picture a German online store: an English claim in the header, a link labeled “English” in the top corner, product names such as “Kiel 30” in the listing. Sighted visitors barely notice. A screen reader, however, reads every word with the voice and pronunciation rules of the language declared in the code. If that declaration is missing or wrong, “Made to last” comes out as a German-sounding jumble, and a German text read by an English voice is hard to follow. WCAG covers this in two success criteria: 3.1.1 requires the main language of every page, 3.1.2 the language of individual passages that differ from it (W3C, WCAG 2.2). On 13.5 percent (WebAIM Million 2026) of the home pages analyzed, even the main language was missing. This article shows where the lang attribute belongs, which language codes are valid, when an English word on a German page needs its own markup and when it does not, how to label a language switcher and how to check the result by ear with a screen reader.
Key takeaways
- The main language belongs in
langon the html element of every template,lang="de"on German pages; 13.5 percent of home pages had no document language at all (WebAIM Million 2026). - When a passage differs, such as an English claim, a quote or a download title, its element needs its own
lang; success criterion 3.1.2 requires this at level AA (W3C, WCAG 2.2). - Proper names, technical terms and adopted words such as newsletter are exempt; the test question is whether the word would be pronounced the same in the surrounding language (W3C, Understanding 3.1.2).
- Language codes stay as short as possible:
deandenare usually enough,de-CHoren-GBonly when the distinction matters in context (W3C, Choosing a language tag). - In a language switcher each language appears in its own language, so “English” with
lang="en"on the link;hreflangonly hints at the target and does not replacelang(MDN). - Testing happens in the code and by ear: NVDA switches voices automatically by default, and 70.3 percent of respondents use more than one screen reader (WebAIM 2026).
Two criteria: language of page and language of parts
Success criterion 3.1.1 Language of Page sits at level A and requires that the default human language of each web page can be programmatically determined (W3C, WCAG 2.2). This means the language used most on the page; if several languages are used equally, the first one used counts (W3C, Understanding 3.1.1). Success criterion 3.1.2 Language of Parts sits at level AA and goes one level deeper: the language of each passage and phrase must be programmatically determinable. The criterion names four exceptions (W3C, Understanding 3.1.2): proper names, technical terms, words of indeterminate language, and words or phrases that have become part of the vernacular of the immediately surrounding text.
In HTML, programmatically determinable means the language is stated in the lang attribute. Anything not marked separately belongs to the main language of the page, so in single-language pages the language of all content is already determined (W3C, Understanding 3.1.2). Even a single word can fall under 3.1.2, because a passage consists of one or more words (W3C, Understanding 3.1.2). For multilingual sites that only target level A, the Working Group strongly encourages implementing 3.1.2 anyway (W3C, Understanding 3.1.1). Anyone testing against WCAG 2.2 AA or the European standard has both criteria in the mandatory part in any case.
What a wrong language declaration sounds like
A screen reader uses the language declaration to load the matching pronunciation rules (W3C, Understanding 3.1.1). If a language change is not marked, the speech output tries to speak the foreign word by the rules of its default language. The W3C gives the example of the French word “voiture”, which an English speech synthesizer pronounces as “voyture” (W3C, Understanding 3.1.2). On a German store page the same happens to an English claim: without markup, “Made to last” comes out sounding like the German word „Made“, which means maggot. The reverse is just as bad: an English voice reads an entire German page aloud when the page template says lang="en".
Blind people are not the only ones affected. Besides screen reader users, the W3C names people who find it difficult to read fluently and people with certain cognitive, language and learning disabilities who use text-to-speech software (W3C, Understanding 3.1.2). At the end of 2025, just over 7.8 million people with severe disabilities lived in Germany (Destatis); for 4 percent of them, blindness or visual impairment was the most severe disability (Destatis). Braille output adds another layer: braille translation software can only follow language changes when they are marked, which prevents incorrectly formed contractions (W3C, Understanding 3.1.2). 38 percent (WebAIM 2024) of surveyed screen reader users with disabilities also read along on braille output.
The declaration matters even without assistive technology. Automatic hyphenation with hyphens: auto depends on the lang attribute; browsers only hyphenate if the attribute is present and a matching hyphenation dictionary is available (MDN). Quotation marks that browsers add for the q element follow the inherited language under the default quotes: auto, so German gets „…“ and English “…” (MDN). And automatic translation in the browser can misinterpret content without a declared language (Web Almanac 2025). A correct language declaration therefore improves pronunciation, typesetting and translation at once.
The main language on the html element
The main language goes on the html element, not on body: only then does it also cover the page title and everything else in head (W3C, Declaring language in HTML). All elements inherit the value from there. A meta http-equiv="Content-Language" declaration does not replace it; the W3C advises against that route, and the in-page declaration overrides HTTP information when it comes to the language of the text (W3C, Declaring language in HTML). CSS cannot declare the language, and the “EN” in an old XHTML doctype refers to the language of the schema, not of the content (W3C, Declaring language in HTML).
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Wanderrucksäcke – Beispielshop</title>
</head>
<body>
<!-- everything here inherits lang="de" unless marked otherwise -->
</body>
</html>The annual analysis of one million home pages shows how common the gap is: 13.5 percent (WebAIM Million 2026) were missing a document language. In 2019 the share was still 33.1 percent (WebAIM Million 2026). The HTTP Archive arrives at a similar picture with a different method: roughly 86 percent of sites include a valid lang attribute, largely unchanged from the previous year (Web Almanac 2025). How to find the declaration yourself in a minute is described in our BFSG self-check without tools. This article covers what that simple check does not show: whether the value is correct and whether language changes within the page are marked.
The typical template error: English on the German page
A lang attribute can be present and still be wrong. A typical way to get there: the page skeleton comes from an English template, the texts were translated, the attribute stayed. On multilingual sites the error often appears in only one version, because both languages share the same template and the value is hard-coded instead of coming from the language version. For screen reader users this is worse than a missing declaration: if it is missing, the screen reader reads in its configured language. If it says en, NVDA, for example, switches to an English voice by default, provided one is installed (NVDA User Guide), and reads the whole German page in English.
Other values mislead as well. An empty lang="" explicitly declares the language unknown, and a value that does not conform to BCP 47 counts as invalid (MDN). Typical examples are lang="german", lang="de_DE" with an underscore, or a placeholder such as lang="{{ locale }}" that was never replaced in the delivered HTML. So do not check the template, check the HTML that reaches the browser, in every language version and for every page type: home page, category, product, cart, checkout, search results, error page and legal pages. Checkout and error pages may come from separate templates and are easily left behind in a rework.
Online stores have a second source of wrong language. System texts such as cart labels, shipping notes or error messages come from language files, product texts from the database. If a translation is missing and the system falls back to a default language, an English sentence suddenly appears on the German page, without markup. That is a translation error first, but as long as it is live it is also a 3.1.2 finding. The better fix is the missing translation, not a lang attribute added to the English leftover.
Language codes: short and valid
Values of the lang attribute follow the BCP 47 standard; the building blocks are listed in a public registry maintained by IANA (W3C, Declaring language in HTML). That registry is long, with nearly 8,000 entries (W3C, Choosing a language tag). German websites usually need two of them: de and en. A language code consists of one or more subtags joined by hyphens (W3C, Choosing a language tag). The W3C’s golden rule is to keep the code as short as possible and add further subtags only when they distinguish something in the context where the content is used (W3C, Choosing a language tag).
Region subtags such as de-CH, de-AT or en-GB are therefore the exception. They make sense when the distinction has an effect, for example for spell-checking (W3C, Choosing a language tag). A version for Switzerland can carry de-CH so that spell-checking and hyphenation fit. For speech output the region often changes little: NVDA only switches accents for dialect declarations such as British instead of American English when automatic dialect switching is enabled, and it is disabled by default (NVDA User Guide).
| Value | Meaning | Use |
|---|---|---|
de | German | main language of German pages, the normal case |
en | English | English version and English passages on German pages |
de-CH | German as used in Switzerland | only if the version should differ from de |
en-GB or en-US | British or American English | rarely needed, NVDA does not switch accents by default |
lang="" | language explicitly unknown | only for content whose language cannot be determined |
de_DE, german | not a valid language code | avoid: subtags are joined by hyphens, language names are not codes |
Language changes in text: claims, quotes, downloads
Success criterion 3.1.2 covers everything on a page that is in another language and not covered by the exceptions. In German online stores and on company websites these are mainly the following spots:
- Claims and slogans: A brand promise such as “Made to last” or “Built for the outdoors” on a German page is an English sentence and needs
lang="en"on the surrounding element. - Quotes and outside texts: An English quote in a German article, a manufacturer text or an English customer review among German ones gets the markup on the
blockquoteor on the element holding the text (W3C, Technique H58). - Downloads and documents: A link “Care Guide (PDF, Englisch)” pointing to English care instructions carries the language of its text, and the note in the link text says that the target is English as well.
- Legal and technical passages: License terms, safety notes or data sheets that only exist in English are whole passages in another language.
- Embedded content: Video titles, captions and texts in embedded maps or forms that are delivered in another language.
<section class="hero">
<p class="claim" lang="en">Made to last</p>
<p>Wanderrucksäcke, die Wind und Wetter aushalten.</p>
</section>
<p class="hinweis" lang="en">Keep away from open flames.</p>
<a href="/downloads/kiel-30-care-guide.pdf">
<span lang="en">Care Guide</span> (PDF, Englisch)
</a>Where the attribute sits determines its reach. lang applies to the element and everything inside it, including the element’s attributes (W3C, Declaring language in HTML). If there is no suitable element, add one, usually a span (W3C, Declaring language in HTML). For whole paragraphs the attribute belongs on the paragraph, not on every single word. And if a content management system does not allow markup in the text, it is worth adapting the editor: for editors, marking a language change should be as easy as making text bold.
The exceptions: proper names, technical terms, adopted words
The exceptions are not a loophole but part of the rule. Proper names generally do not require an explicit change of language; the W3C explicitly includes a product’s brand name and the names of specific people or places (W3C, Understanding 3.1.2). A product name such as “Kiel 30” stays unmarked, as does an English company name in German text. Technical terms often originate from another language and are not translated; the W3C gives examples such as hertz or habeas corpus (W3C, Understanding 3.1.2). Words that have become part of the surrounding language need nothing either: in German, for instance, “Newsletter”, “Download” or „Onlineshop“.
For borderline cases the W3C provides a test question: would the word be pronounced the same in the language of the immediately surrounding text, except for accent or intonation (W3C, Understanding 3.1.2)? Single words are considered part of the surrounding language unless a change in language was clearly intended (W3C, Understanding 3.1.2). This gives a practical rule of thumb: single common words stay unmarked, whole phrases and sentences in another language are marked. “Sale” on a German promotional banner is a borderline case, “Free shipping on all orders” is clearly an English sentence.
| Example in German text | Markup | Reason |
|---|---|---|
| “Made to last” as a claim | lang="en" | whole English sentence |
| “Kiel 30” as a product name | none | proper name |
| Newsletter, Download, Onlineshop | none | adopted into German vocabulary |
| hertz, habeas corpus | none | technical terms (W3C, Understanding 3.1.2) |
| “Free shipping on all orders” | lang="en" | sentence that becomes unintelligible in German pronunciation |
| Quote from an English standard | lang="en" on the quote | whole passage in another language |
Proper names still deserve a second look. Pronunciation quality varies significantly across screen readers and speech synthesizers, and proper names in particular easily become unintelligible (W3C, Understanding 3.1.2). The W3C therefore calls it a best practice to indicate the source language even where the criterion does not require it (W3C, Understanding 3.1.2). Machine translation has its own attribute: translate="no" asks translation tools to leave a brand name unchanged, for example, and has nothing to do with pronunciation (MDN).
The language switcher in its own language
Both criteria meet in the language switcher. The W3C describes the pattern as an example for 3.1.2: each link names the target language in that language, such as „Deutsch“, “Français” or “English”, and carries the matching lang attribute (W3C, Understanding 3.1.2). On a German page, the link to the English version therefore reads “English” with lang="en", not „Englisch“. People looking for the English version recognize the word in their language, and the screen reader pronounces it in English. The English page mirrors this: „Deutsch“ with lang="de".
<nav aria-label="Sprache">
<ul>
<li><a href="/de/" aria-current="true">Deutsch</a></li>
<li><a href="/en/" hreflang="en" lang="en">English</a></li>
</ul>
</nav>
<!-- with a title in the page language: lang goes on the link text -->
<a href="/en/" hreflang="en" title="Englische Fassung"><span lang="en">English</span></a>Two details. First, if the link also has a title in the language of the page, lang does not go on the link but on a span around the link text; otherwise the title would be marked as English too (W3C, Declaring language in HTML). Second, the hreflang attribute only describes the language of the target, has no built-in functionality and does not replace lang (MDN). Declaring language versions has its own meaning for search engines, but none for how the link text is pronounced.
The W3C names one limit itself. In some modes, screen readers announce an element only by its computed accessible name, for example in the list of all links on a page. These names are flat strings without language information, so the language change is lost there (W3C, Understanding 3.1.2). One workaround is to put lang directly on the link instead of on a child element, though this may not work in every combination of browser and assistive technology (W3C, Understanding 3.1.2). Without a title, the attribute on the link is therefore the more robust choice. Such limits of assistive technology do not fail the criterion; what counts is whether the code declares the language correctly (W3C, Understanding 3.1.2). How links and buttons get their names is covered in the article on empty links and buttons.
Limits: attributes, page titles and documents
Not every text can be marked in parts. The page title allows no markup, so a bilingual title cannot distinguish its parts; the same applies to attribute values, and according to the W3C there is no good solution for this at the moment (W3C, Declaring language in HTML). Alternative text is an attribute: if it is entirely in another language, lang can sit on the img, because the attribute also covers the element’s attributes. In most cases, though, it is better to write the alternative text in the language of the page. How good alternative text comes about is shown in the article on accessible images and alt text.
Documents follow the same principle. The European standard EN 301 549 transfers both criteria to non-web documents in clauses 10.3.1.1 and 10.3.1.2 and notes that some document technologies have no method supported by assistive technology for marking language changes (EN 301 549). For PDFs this means: set the document language and mark differing passages in the structure. Details are in the article on accessible PDFs and on our page on PDF accessibility. For emails the same logic applies in the head of the template, as the article on accessible newsletters shows.
How to test language and language changes
Testing has two parts: reading the code and hearing what comes out. The W3C stresses that an evaluation cannot rely solely on the spoken output but must verify whether language changes are marked correctly in the code (W3C, Understanding 3.1.2). A sequence that works well in practice:
- Main language per version: read the value on the
htmlelement in the delivered HTML of every language version and page type, not in the template. - Check the values: valid, short codes, no underscores, no empty values, no unreplaced placeholders.
- Collect foreign-language spots: go through claims, banners, quotes, reviews, download links, the language switcher and system texts, and hold each spot against the exceptions.
- Read the code at those spots: use the browser’s developer tools to check whether the element or an ancestor carries the matching
lang. - Listen: have a screen reader read the page aloud. In NVDA, automatic language switching is enabled by default; reporting language changes while reading is disabled and can be turned on for the test (NVDA User Guide).
- Cross-check: use a second screen reader, because pronunciation and speech quality vary considerably (W3C, Understanding 3.1.2).
You need the second screen reader for more than testing. 70.3 percent (WebAIM 2026) of respondents use more than one desktop or laptop screen reader, and 59.3 percent (WebAIM 2026) use NVDA. If the current voice does not support the declared language, NVDA can announce this by speech or a beep; speech is the default (NVDA User Guide). How screen readers read a page overall and what to watch for when testing is covered in the article on screen reader optimization.
What the BFSG requires
Under section 3 paragraph 1 of the German Accessibility Act (Barrierefreiheitsstärkungsgesetz), products and services are accessible if people with disabilities can find, access and use them in the usual way, without particular difficulty and, in principle, without outside help (BFSG). A store page that a screen reader reads in the wrong language is usable only with effort at best. Under section 3 paragraph 3, microenterprises that offer or provide services are exempt (BFSG).
Under section 3 paragraph 1, the specific requirements are laid down in a separate ordinance (BFSG); in practice, the European standard EN 301 549 serves as the technical benchmark. For web pages, clause 9.3.1.1 requires meeting WCAG 2.1 success criterion 3.1.1, and clause 9.3.1.2 likewise criterion 3.1.2 (EN 301 549). Which version of the standard applies is explained in the article on the standard behind the BFSG; which obligations apply to whom is on our page on BFSG requirements. Both criteria are therefore not a side issue but part of every audit against WCAG 2.2 AA.
How we build in language markup
Language markup is rarely wrong in just one place. The page skeleton comes from a template, the claims from the content management system, the system texts from language files and the switcher from a component. That is why we work in four steps:
- Inventory: we read the main language and language changes in the delivered HTML of every language version and page type in scope and listen to the pages with a screen reader.
- List of language changes: every foreign-language spot is recorded and classified: mark it, leave it as an exception or translate it.
- Fix at the source: the template sets
langon the html element per version, the switcher gets its pattern in the component, and where the content management system allows it, the editor gets markup for language changes. How to build such rules into components is shown in the article on the accessible design system. - Evidence: after the rework we test again, in the code and by ear, and record the result per criterion in the audit report.
Checking pronunciation is part of our screen reader testing, in which we assess what your website hands over to screen readers. In the full WCAG audit, 3.1.1 and 3.1.2 sit alongside all other level AA criteria. So that new content carries the markup from the start, language changes also belong in editorial training; what matters there is described in the article on accessible content in the editorial team.
Sources
lang. That applies to most online stores, because the “English” link in the header alone is a language change.translate="no" (MDN).lang (W3C, Understanding 3.1.2). If the link also has a title in the language of the page, lang goes on a span around the link text (W3C, Declaring language in HTML). hreflang on the link is an additional hint at the language of the target but does not replace lang (MDN).de. The W3C advises keeping language codes as short as possible and adding regions only when they distinguish something in context (W3C, Choosing a language tag). de-DE is valid but usually adds nothing over de. de-CH is worth it when a Swiss version differs, for example in spelling. Spellings with an underscore such as de_DE are invalid.Related Articles
Headings in Components: Setting Levels Correctly in Code
Headings in components: the level per placement as a parameter, multiple h1 elements, sectioning elements, hidden headings and role=heading under WCAG 2.2.
Empty Links and Buttons: Giving Controls a Clear Name
Empty links and buttons are among the most common WCAG findings. Fix patterns for icon buttons, image links and “more” links, checked via the links list.
Accessible Product Pages: Variants, Gallery, Add to Cart
A flaw in the product template appears on every item page. How to make variant choice, gallery, price line and add-to-cart feedback accessible.