Use valid language codes in the `lang` attribute

Accessibility isn’t only about avoiding violations — it’s about ensuring your product can be used confidently by everyone. This guide explains the principle of this rule, shows what goes wrong in real-world code, and provides a verified fix that meets WCAG and the European Accessibility Act (EAA).

Why this matters and how to fix it

Why this matters

Assistive technologies depend on standardized language codes to apply correct pronunciation and braille translation rules. Invalid or misspelled codes can cause screen readers to fall back to the wrong voice profile.

How to fix this issue

Use valid BCP 47 language codes (e.g., `en`, `en-US`, `sv-SE`, `fr-FR`). Avoid custom or incomplete tags like `english` or `us-en`.

Automated detection · Manual review recommended

Developer guidance

Validate all `lang` attributes using a linter or accessibility testing tool. Maintain a locale map if your app supports multiple languages.


Code examples

Incorrect Implementation

<html lang='english'>

Correct Implementation

<html lang='en'>
eu icon getwcag

Trusted by organizations across Europe working toward WCAG and EAA conformance