Back to All Rules
Serious3.1.1 Language of Page (Level A), 3.1.2 Language of Parts (Level AA)Rule ID: valid-lang

lang attributes must use valid language tags

A `lang` attribute contains an invalid or malformed BCP 47 language tag.

Rule Description

Checks lang values on any element and validates tag format against recognized language-subtag conventions.

Why It Matters

  • Screen readers may pronounce content incorrectly
  • Translation and speech tools rely on valid language tags
  • Mixed-language content becomes harder to understand

How to Fix

Use valid BCP 47 tags such as en, en-US, fr, es-MX.

Bad Example:

<html lang="english"> <p lang="spn">Hola</p>

Good Example:

<html lang="en"> <p lang="es">Hola</p>

Common Mistakes

  • Full language names instead of tags
  • Typos in region/script subtags
  • Empty lang values

Testing

  • Validate tags using browser/tooling language checks
  • Test pronunciation with screen reader language switching
  • Audit localized sections for correct lang

External Resources

Automate Your Accessibility Testing

Our tool automatically checks for this rule and hundreds of other accessibility issues.

Start Your Free Trial