← Back to SEO LearnNOTABIS SEO / LEARN

Accessibility · 16 September 2026

HTML Language Attributes: Why They Matter

The HTML lang attribute declares a document’s primary language. NOTABIS records a passed check when a non-empty root language attribute is present, while Google determines language mainly from page text.

Quick answer

The lang attribute on the <html> element declares the document’s language, for example lang="en-GB". It helps browsers and assistive technology choose pronunciation and language rules, but Google says it determines page language primarily from the text itself. NOTABIS records a passed language-present check when a non-empty HTML language attribute is present.

What the issue means

The language declaration belongs on the root element of the document:

<html lang="en-GB">

The value should describe the language of the page, with an optional region where that distinction matters. A page can contain an occasional quoted phrase in another language without changing its main document language; use a nested lang attribute for a substantial passage that switches language.

Why it matters for SEO

A language declaration improves the page’s semantic and accessibility baseline and can help user agents handle text correctly. It is not a ranking switch, and Google does not use the HTML lang attribute by itself to detect the language of a page. Separate URLs and hreflang annotations are the tools to review when a site serves regional or translated versions.

How NOTABIS detects it

The language-present rule is a page-level passed check. NOTABIS reads the lang attribute from the document’s <html> element and records the check when the value is non-empty. It does not validate that the value is an approved language or region code, compare it with the page’s prose, or inspect nested language spans. A client-rendered change may not appear in the initial HTML that the audit measures.

How to check it yourself

Inspect the first <html> element in the DOM and View Source. Confirm that the value matches the page’s primary language and that translated routes are not all returning the same declaration. A browser accessibility inspector can show whether the language is being applied to the document and to any nested passages.

How to fix it

Set the correct language in the shared document template and keep it consistent across server-rendered and client-rendered responses. Use a valid language tag such as en, fr, or en-GB rather than a country-only value. For a translated block inside an English page, mark that block separately:

<p lang="fr">Bonjour et bienvenue.</p>

Recheck the final HTML for each locale and test a representative page with a screen reader or text-to-speech tool.

When this is intentional or does not need fixing

An API response, redirect, or non-HTML resource does not use an HTML root element. A page whose text intentionally mixes languages can still declare its dominant language and mark meaningful passages individually. Do not set a language merely to silence a check when the content is actually unknown; fix the template or content source instead.

Related issues

Review missing main landmarks, missing H1 tags, and viewport declarations as part of the document’s structural baseline. Google’s guidance on localized versions covers language and regional URL strategy.

Run a NOTABIS audit

NOTABIS records whether each crawled HTML page declares a root language, so you can find templates that omit it across a site.

Measure before you change

See which issues affect your site.
Run a NOTABIS audit ↗