How to set the page language
WCAG: 3.1.1 Language of Page (A) and 3.1.2 Language of Parts (AA) ยท Updated October 14, 2026
The lang attribute tells screen readers which voice and pronunciation rules to use. Without it, English text can be read with the wrong accent, and translation tools may guess wrong.
The fix
<html lang="en">Use a valid code: en, en-US, es, es-MX, fr, de, zh-Hans. Values like english or en_US are invalid.
Passages in another language
<p>Our motto is <span lang="es">siempre a tiempo</span>.</p>
Where to set it
- WordPress: Settings, General, Site Language. Themes print it with
language_attributes(); a custom header.php missing it is a common cause. - Shopify: it comes from the store language; check your theme.liquid has
lang="{{ request.locale.iso_code }}". - Static sites: edit the html tag in your base template.
Step by step
- Check the html tag. View source and look for a lang attribute on the html element.
- Add a valid code. Set lang to a valid BCP 47 code in your template or CMS settings.
- Mark other languages. Add lang to elements that contain another language.
- Re-scan. Confirm html-has-lang and html-lang-valid pass.
Check your page. Run a free scan to see which of these issues it finds.
Automated accessibility scan. Results are informational and may not identify every accessibility issue. This service is not legal advice, a compliance certification, or a substitute for comprehensive manual accessibility testing.