Valid language tag in the lang attribute

Last updated:

How to fix this issue?

Use a valid BCP 47 language tag in the lang attribute. A language tag consists of a primary language subtag and an optional region subtag:

CORRECT:

primary language only

<html lang="en">
CORRECT:

language and region

<html lang="en-US">
<html lang="nl-NL">
<html lang="fr-FR">
BAD:

invalid BCP 47 tag on inline elements

<p lang="english">This is in English.</p>
<p lang="Dutch">Dit is in het Nederlands.</p>
<p lang="EN_US">Mix of English.</p>

Common valid language tags:

  • en: English
  • nl: Dutch
  • de: German
  • fr: French
  • es: Spanish
  • pt-BR: Brazilian Portuguese

You can also apply the lang attribute to individual elements when part of the page uses a different language:

<p>This is in English.</p>
<p lang="nl">Dit is in het Nederlands.</p>

Why is this important?

Screen readers use the lang attribute to select the correct voice, pronunciation rules, and dictionary. An invalid language tag causes the screen reader to use the wrong language settings, making the text hard or impossible to understand for the user.

More info:

WCAG 3.1.2 Language of Parts.

MDN: BCP 47 language tag.

Rule info

Standard

WCAG AA SC 3.1.2

Regulations

EN 301 549 RGAA EAA AODA

User impact

Fix complexity

Affects

Was this article helpful?

Checkout the ExcellentWebCheck services

ExcellentWebCheck's goal is to improve the online user experience. The tools of ExcellentWebCheck help to detect and improve usability problems on your website.