Skip to the content
Start free

Hreflang and HTML lang mismatch

A hreflang and HTML lang mismatch is when a page’s hreflang annotation says it is for one language or region, but the lang attribute on its <html> element says another. Google does not use either one to detect a page’s language, so the mismatch is rarely the cause of a ranking problem. It is a sign that a template or plugin is wrong, and it does affect screen readers and other tools.

What are the two attributes? #

They look alike but do different jobs.

hreflang lang
Where <link rel="alternate"> in the head, a Link header or the sitemap On the <html> element, or any element
What it says “This other address is the version for this audience” “The text here is written in this language”
Who reads it Search engines choosing which URL to show Browsers, screen readers and CSS
Code format ISO 639-1 language, optional ISO 3166-1 Alpha 2 region, e.g. en-GB A BCP 47 language tag, e.g. en-GB

Hreflang is covered by Google’s guide to localised versions of your pages. The lang attribute is covered by MDN’s page on the lang global attribute and the W3C’s advice on declaring language in HTML.

What does a mismatch look like? #

A UK page that lists itself in its hreflang set as British English, while the template still carries the US default:

<html lang="en-US">
<head>
<link href="https://kettles.example/gb/" hreflang="en-GB" rel="alternate">
<link href="https://kettles.example/fr/" hreflang="fr-FR" rel="alternate">
<link href="https://kettles.example/" hreflang="x-default" rel="alternate">

Other common forms: a French page with lang="en" because every language copy shares one theme; a German page whose hreflang says de but whose body text is still English; or no lang at all.

Does Google care? #

Less than most people think. Google’s page on managing multi-regional and multilingual sites says it works out a page’s language from the visible content. Markup in the code, the lang attribute included, plays no part in that, and nor does the address. Google’s hreflang guide repeats the point: neither annotation is how it decides what language a page is in.

So what does hreflang do? It tells Google which addresses are versions of each other, so it can show the right one to each searcher. That is why the hreflang rules that matter to Google are about the set, not the lang tag:

  • Every copy names all its siblings and names itself too.
  • Links must go both ways. Google says that if two pages do not both point to each other, the tags will be ignored.
  • Codes must be valid. A region on its own is not valid, and Google says UK, EU and UN have no effect. The UK code is GB.
  • x-default marks the page for anyone who matches no listed version.

Because the mismatch usually points to a bigger fault. If the lang says English on your French page, ask why. Often the answer is that the page is not fully translated, or that one template is serving every locale with the wrong set of tags. Wrong-language pages can also look like duplicate content to a crawler. The real question is whether the visible text matches what your hreflang promises. If your fr-FR page is mostly English, Google reads it as English, and the hreflang set no longer describes what is on the page. See international SEO and multilingual SEO.

Other search engines may weigh language code differently. Google is the only one whose position we have confirmed from its own documents, so test with Bing too, using Bing Webmaster Tools.

Why does it matter for people and AI tools? #

MDN explains that the main purpose of lang is to let assistive tools such as screen readers pick the right pronunciation, and that accessibility rules expect the page language to be set in code. A French page marked lang="en" will be read aloud with English sounds. That is a real cost to real visitors, covered in web accessibility.

For AI tools the effect is indirect. Many read the text itself to judge language, as Google does. Where a tool does read lang, a wrong value is a wrong fact about your page. Clean, matching signals are part of technical SEO for AI search.

How does it happen? #

  • A theme hard-codes lang="en-US" and the translation plugin never changes it.
  • The site language setting in the CMS is left at the install default.
  • Hreflang comes from one source (a sitemap file) and lang from another (the template), so they drift. Keep one source of truth, as with an XML sitemap that drives everything.
  • Pages are copied for a new market before the text is translated, as part of localisation.
  • Codes are mixed: en_GB with an underscore, or en-UK.

Common mistakes #

  • Fixing lang and calling it done. If the hreflang set is missing return links, it is still ignored.
  • Expecting lang to rank a page in a country. It does not. Targeting comes from hreflang, content and other signals described in geotargeting.
  • Using a Content-Language meta tag instead. The W3C says never to use the meta form to declare a page’s language. Use lang on the <html> element. It is one of the basic meta tag and HTML hygiene checks.
  • Redirecting by browser language. Google advises against automatic redirects based on a guess about the user’s language. Give visible links instead, ideally in your website navigation.
  • Invalid codes. Google says codes outside the ISO standards, such as es-419, are not supported in hreflang, even though es-419 is valid in lang. This is one place where the two can rightly differ.

A worked example #

A UK tool supplier has three versions: /uk/ (English, UK), /ie/ (English, Ireland) and /fr/ (French, France). An audit shows all three carry lang="en-US".

  1. Check the hreflang set first. Each page lists en-GB, en-IE, fr-FR and x-default, including itself. Return links are in place. Good.
  2. Check the text. The French page has an English menu and footer. That is the bigger fault.
  3. Fix the template. Set lang from each locale: en-GB, en-IE, fr-FR. Translate the French menu and footer.
  4. Re-test. Hreflang and lang now agree on every page, and the French page reads as French. The supplier then watches impressions by country in the Search Console performance report.

The hreflang set did not change. What improved was the match between code, content and promise.

How to check it #

  1. Run each version through our hreflang checker to see the set, the codes and the return links.
  2. View the source, or use our meta tag checker, to read the lang on the <html> element.
  3. Check for hreflang sent in a Link header with our HTTP header checker, and in the sitemap with our sitemap checker.
  4. Read the page. Is the visible text in the language both codes claim? Our readability checker helps with the English copies.
  5. For many pages, run our SEO audit. In URSY Pro, the hreflang audit (Pro) checks every set across a site.

Questions #

Must hreflang and lang be identical? #

No rule says so. They describe the same page, so they should agree on the language. The region may be more or less specific in one than the other.

Will fixing lang raise my rankings? #

Not on Google, by its own account. It does help screen reader users and keeps your code honest.

What if my page has no lang at all? #

MDN says the language is then unknown unless a header supplies it. Add one.

Sources #

Updated 25 November 2026 by URSY.

Cite this page: Hreflang and HTML lang mismatch. URSY. Updated 25 November 2026. https://ursy.com/wiki/hreflang-and-html-lang-mismatch/ · Section links

Tools for this

  • LiveHreflang Checker + Generatorlanguage versions wired both ways, or the tags written for youRun the check →
  • LiveVerify an AI Botis it really GPTBot? IP, published lists and user agentRun the check →
  • Livellms.txt Checker + Generatorcheck your llms.txt, or write llms.txt, llms-full.txt and llms.jsonRun the check →
  • LiveAI Training Opt-Out Checker + Generatorwhat each AI may do with your site, and the exact lines to change itRun the check →
  • LiveAI Consistency Checkerpage, schema, llms.txt and feeds state the same facts?Run the check →
  • LiveGoogle Snippet Previewtitle and description length in pixels (in browser)Run the check →
  • ProHreflang auditLanguages wired correctly?In URSY Pro →
  • ProAI competitor gapPrompts where rivals appear and you don'tIn URSY Pro →
  • ProAI fact accuracy monitorAI quoting your prices and facts wrong, with alertsIn URSY Pro →

All 871 wiki entries, A to Z →