Skip to content

The lang attribute on <html>

mediumaccessibility-lang-attributereviewed

One attribute decides which voice a screen reader uses to read your page. What it affects, what a wrong value sounds like, and how to set it.

What it is

The lang attribute on the <html> element declares the document's primary language, as a BCP 47 tag: lang="en", lang="en-GB", lang="pt-BR". This check reads the served HTML and fails when the attribute is missing or empty.

It reads the raw markup rather than a rendered page, so it runs on every scan whether or not a rendering engine was available.

Why it matters

A screen reader picks its pronunciation rules and voice from this attribute. Without it, the software guesses — usually from the user's system locale — and English prose read by a synthesiser configured for German is not slightly degraded, it is unintelligible.

It also drives quieter things: which dictionary the browser spell-checks against, which quotation marks CSS generates, and whether a translation offer is even made. One attribute, set once per document, and none of it is recoverable by any amount of work elsewhere.

How to fix it

with a reference doc
html
<html lang="en">

<!-- a passage in another language marks itself -->
<blockquote lang="fr">Tout est pour le mieux…</blockquote>

Reference documentation

Related checks

4
highColor contrastThis reads Lighthouse's own color-contrast audit: whether text has enough contrast against its background, judged by the WCAG formula rather than eyeballed. The threshold is 4.5:1 for normal text and 3:1 for large text (18pt+, or 14pt+ bold).highForm field labelsThis checks that every form field has an associated label — a <label> with a for attribute matching the field's id, or the input nested inside the label — read from Lighthouse's rendered-DOM audit rather than the raw HTML, so it catches labels missing at render time as well as in markup.lowHeading hierarchyHeading hierarchy is whether a page's <h1> through <h6> tags step down one level at a time — an <h2> can be followed by another <h2> or an <h3>, but not by an <h4> with no <h3> in between. This check reads the sequence of heading tags in the order they appear in the HTML.mediumMissing H1The <h1> is the top-level heading of a document: the one sentence that says what this page is. This check counts <h1> elements in the served HTML and fails when there are none.

This is one of the 75 checks the scanner runs. See what we check for the full list, every severity weight, and how the score is computed from them.

See whether your own site passes the lang attribute on <html>.

One page, all 75 checks, free. No account, no card.

Check this on my site