---
title: "The lang attribute on "
category: foundations
status: required
url: https://webspecification.com/spec/foundations/html-lang/
updated: "2026-05-29T09:13:20.000Z"
sources:
- title: "HTML Living Standard — The lang and xml:lang attributes"
url: "https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes"
publisher: "WHATWG"
- title: "MDN — HTML lang global attribute"
url: "https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang"
publisher: "MDN"
- title: "BCP 47 — Tags for Identifying Languages"
url: "https://www.rfc-editor.org/info/bcp47"
publisher: "IETF"
- title: "WCAG 3.1.1 — Language of Page (Level A)"
url: "https://www.w3.org/WAI/WCAG22/Understanding/language-of-page.html"
publisher: "W3C"
source_repo: undefined
licence: CC-BY-4.0
---
# The lang attribute on
> Set a valid BCP 47 language tag on the element so screen readers, translators, search engines, and browsers know what language the page is in.
## What it is
Every HTML document should declare its primary language on the root element using the `lang` attribute:
```html
```
The value is a **BCP 47 language tag** — a short, standardised string that identifies a language and, optionally, a region or script. Examples: `en`, `en-GB`, `nl`, `pt-BR`, `zh-Hant`, `de-AT`.
## Why it matters
The language of the page is metadata that many systems rely on:
- **Screen readers** switch pronunciation engines based on `lang`. Without it, VoiceOver and NVDA read English text with a Dutch accent, or vice versa, making content unintelligible.
- **Browsers** offer translation prompts ("Translate this page from French?") only when they know the source language.
- **Search engines** use it as one signal for which audience to show the page to.
- **Spell checkers** in `