---
title: "HTML lang Attribute: Declare Each Page's Language · Rubric"
description: Put a lang attribute on the html element of every page, and make it match the text, so browsers and screen readers read the page correctly.
url: https://rubric.design/ux/accessibility.page-language-is-declared
format: agent view of this page
updated: 2026-11-16
---

[UX guides](https://rubric.design/ux/) / [Accessibility](https://rubric.design/ux/topic/accessibility) / Every page declares its main language, and the declaration matches the text

# Every page declares its main language, and the declaration matches the text

Usually medium · How serious this usually is when it goes wrong. Not a score.

## The guideline

Put a lang attribute on the html element of every page, holding a well-formed BCP 47 language tag for the language the page mainly uses (for example en, fr or pt-BR). Make it match the text: a translated page needs its own value, so a template must not leave lang="en" on a German page. On a site in several languages, each language version declares its own. Where a page mixes languages, declare the one used most.

## Common failures

- The page does not declare its language correctly: the lang attribute is missing, empty, malformed, or names a different language from the text.

## Where it applies

### Where

- Applies to any site

### Disciplines

- Accessibility

### Devices

- Desktop web
- Mobile web

## Why it matters, how to fix it, and the research behind it

Rubric's full guide adds the reasoning, the fix and the sources for this check, and checks your pages against it and the rest of the checklist, the way a visitor would meet them. Findings come back worst first.

[Use demo account](https://rubric.design/demo) · [Use it from your coding agent (MCP)](https://rubric.design/#agents)

## Related guides

- [Labels are programmatically associated with their fields](https://rubric.design/ux/accessibility.form-label-association) · Usually critical · Associate every input's visible label with its control using a native \<label for>/id pair, or aria-labelledby when a native label element is not possible.
- [Video and audio content ships with captions and a transcript](https://rubric.design/ux/accessibility.video-captions-transcripts) · Usually critical · Provide synchronized closed captions for every prerecorded video that has a soundtrack, including speaker identification and non-speech sounds that carry…
- [Pages have a descriptive title and a logical heading hierarchy](https://rubric.design/ux/accessibility.heading-structure) · Usually high · Give every page a unique \<title> that identifies its specific content, with the page-specific part first (WCAG 2.2 SC 2.4.2).
- [Pointer targets meet a minimum size or spacing](https://rubric.design/ux/accessibility.pointer-target-size) · Usually high · Make every pointer target at least 24 by 24 CSS pixels — the WCAG 2.2 Level AA floor — and design to 44 by 44 wherever the control carries weight, which is…
- [Password composition rules are shown before submission, not after](https://rubric.design/ux/auth.password-requirements-visible) · Usually high · If the password field enforces composition rules, state them next to the field before the first submit attempt — as static hint text or a live checklist that…
