Website Spec
← Foundations
Required

The lang attribute on <html>

Set a valid BCP 47 language tag on the <html> 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 lang="en">

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:

A missing lang is one of the most common accessibility failures, and one of the easiest to fix.

How to implement

Use a valid BCP 47 tag. The simplest form is just the two-letter ISO 639-1 language code:

<html lang="en">
<html lang="fr">
<html lang="ja">

Add a region only when it changes meaning — currency, spelling, or pronunciation:

<html lang="en-GB">   <!-- British English: "colour", "behaviour" -->
<html lang="en-US">   <!-- American English: "color", "behavior" -->
<html lang="pt-BR">   <!-- Brazilian Portuguese -->
<html lang="zh-Hant"> <!-- Traditional Chinese script -->

For sections of a page in a different language, use lang on a child element:

<p>The French call it <span lang="fr">pamplemousse</span>.</p>

For right-to-left scripts (Arabic, Hebrew), pair lang with dir:

<html lang="ar" dir="rtl">

Common mistakes

Verification

Sources