Skip to content

Test your website now

Free, no card. We read only public pages.

Run free audit →

Browser compat · Info severity

Inconsistent HTML Lang Across Pages: Check the Language of Each Page

Review language differences across pages. Preserve multilingual content, match declarations to real text, and test source and rendered templates.

Published · Updated

What the check tests

Check
compat.lang-region - Language declaration is consistent across pages
Passes when
All pages of a single-language site should declare the same html lang value.
Scope
graded once per site
Severity
Info
Fix effort
small - under an hour
Impact when fixed
low

In one paragraph

Inconsistent HTML lang across pages means the crawl observed multiple primary declarations under this rule's comparison model. Determine whether the site is intentionally multilingual or has stale templates, and set each document's language to its actual primary content. Do not force all pages to one language merely to clear a site-wide warning. A shared code or a disabling hreflang link does not prove that the declarations are accurate.

Why it matters

Language declarations can support pronunciation, hyphenation, and other language-sensitive processing when supported by the client. Incorrect metadata can affect usability, but it does not guarantee every user agent produces one identical voice or translation prompt.

A multilingual site can correctly contain several root languages. Conversely, a single-language site can acquire an unrelated default from an imported template or external help platform. The correct decision comes from the actual page, not the majority language in a crawl.

HTML lang and search hreflang serve different roles. The former declares content language, while the latter can associate language or regional alternatives for search. Do not add inaccurate alternates simply to disable a checker or claim root lang alone determines Google's language targeting.

How WebAuditOS evaluates this finding

The supplied rule compares primary root-lang subtags across crawled pages, including the documented error-page handling. A single observed primary value passes; multiple values warn informationally; absent declarations or any observed hreflang alternate can leave this check ungraded.

Its comparison is case-sensitive, despite language-tag matching generally being case-insensitive. Regional differences collapse to the primary code, missing lang is ignored, and a single alternate can disable comparison without validating the alternate set. It does not judge actual text language or every valid subtag.

How to fix it

  1. Group observed pages by declared value, template, section, and actual content language. Include error views and hosted product resources rather than checking only the homepage.
  2. For a genuinely single-language page, use an appropriate truthful declaration. An English example is:
<html lang="en">

Use a region or script distinction when accurate and useful, not a random code chosen to match another page.

  1. Centralise generation where practical while allowing legitimate per-language routes or content metadata. One shared source should express the correct variable language, not impose one static value on translations.
  2. Correct stale defaults in builders, CMS themes, account pages, documentation systems, and server-generated errors. A product can use several delivery systems even under one hostname.
  3. For intentional multilingual content, retain correct language on each document and mark meaningful changes within it. Review language-of-parts exceptions instead of tagging every borrowed word.
  4. Use appropriate reciprocal hreflang annotations where they serve the real search-alternate model. Do not create one dummy link merely because its presence stops this heuristic.
  5. Test actual rendered declarations during direct navigation and client-side locale changes. Review language-sensitive CSS, widget locale selection, and supported assistive output.
  6. Rescan root presence, valid-tag, mismatch, and site-wide comparison checks separately. A matching primary code does not establish full tag correctness, semantic accuracy, or international search performance.

What the fix can break

A bulk replacement can erase real translations' language and make them harder to read with assistive technology. Review content before standardising.

Normalising case can clear a superficial warning without fixing an incorrect primary language. Treat formatting and factual accuracy as separate tasks.

A root change may affect :lang styles, hyphenation, or components reading the attribute as a locale hint. Test those dependencies without assuming language alone controls every localisation function.

Questions

Does more than one language mean an error?

No. It can be correct for a multilingual site. Verify each page against its content.

Why can en and EN warn?

The supplied comparison is case-sensitive. That heuristic difference is not proof the tags represent different languages.

No. It can disable this rule without proving correct alternates or content declarations.

Review root language, hreflang values, and language validity.

Standards and sources

  • WCAG 2.2 3.1.1

In the report

Test this on your own site

Every scan runs compat.lang-region on every page it crawls, on every plan. The finding carries this id, so a line in a report can be matched to the explanation above - and the free scan needs no account.