---
title: "Hreflang and HTML lang mismatch"
description: "When hreflang and the html lang attribute name different languages. Google uses neither to detect language, but the mismatch flags real faults."
url: https://ursy.com/wiki/hreflang-and-html-lang-mismatch/
updated: 2026-11-25T01:34:16+00:00
publisher: URSY (https://ursy.com/)
cite: Name URSY and link https://ursy.com/wiki/hreflang-and-html-lang-mismatch/
---

# Hreflang and HTML lang mismatch

> When hreflang and the html lang attribute name different languages. Google uses neither to detect language, but the mismatch flags real faults.

**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](https://ursy.com/wiki/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? {#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](https://ursy.com/wiki/search-engine/) choosing which [URL](https://ursy.com/wiki/url/) to show | Browsers, screen readers and [CSS](https://ursy.com/wiki/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](https://ursy.com/wiki/hreflang/) is covered by Google’s guide to [localised versions of your pages](https://developers.google.com/search/docs/specialty/international/localized-versions). The `lang` attribute is covered by MDN’s page on [the lang global attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang) and the W3C’s advice on [declaring language in HTML](https://www.w3.org/International/questions/qa-html-language-declarations).

## What does a mismatch look like? {#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? {#does-google-care}

Less than most people think. Google’s page on [managing multi-regional and multilingual sites](https://developers.google.com/search/docs/specialty/international/managing-multi-regional-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.

## Why does it still matter for search? {#why-does-it-still-matter-for-search}

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](https://ursy.com/wiki/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](https://ursy.com/wiki/international-seo/) and [multilingual SEO](https://ursy.com/wiki/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](https://ursy.com/wiki/bing/) too, using [Bing Webmaster Tools](https://ursy.com/wiki/bing-webmaster-tools/).

## Why does it matter for people and AI 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](https://ursy.com/wiki/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](https://ursy.com/wiki/technical-seo-for-ai-search/).

## How does it happen? {#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](https://ursy.com/wiki/content-management-system-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](https://ursy.com/wiki/xml-sitemap/) that drives everything.
- Pages are copied for a new market before the text is translated, as part of [localisation](https://ursy.com/wiki/localisation/).
- Codes are mixed: `en_GB` with an underscore, or `en-UK`.

## Common mistakes {#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](https://ursy.com/wiki/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](https://ursy.com/wiki/meta-tag/) and [HTML](https://ursy.com/wiki/html/) hygiene checks.
- **Redirecting by browser language.**  Google advises against automatic [redirects](https://ursy.com/wiki/redirect/) based on a guess about the user’s language. Give visible links instead, ideally in your [website navigation](https://ursy.com/wiki/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-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](https://ursy.com/wiki/impressions/) by country in the [Search Console performance report](https://ursy.com/wiki/search-console-performance-report/).

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

## How to check it {#how-to-check-it}

1. Run each version through our [hreflang checker](https://ursy.com/hreflang-checker/) to see the set, the codes and the return links.
2. View the source, or use our [meta tag checker](https://ursy.com/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](https://ursy.com/http-header-checker/), and in the sitemap with our [sitemap checker](https://ursy.com/sitemap-checker/).
4. Read the page. Is the visible text in the language both codes claim? Our [readability checker](https://ursy.com/readability-checker/) helps with the English copies.
5. For many pages, run our [SEO audit](https://ursy.com/seo-audit/). In URSY Pro, the [hreflang audit](https://ursy.com/pro/hreflang-audit/) (Pro) checks every set across a site.

## Questions {#questions}

### Must hreflang and lang be identical? {#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? {#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? {#what-if-my-page-has-no-lang-at-all}

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

## Related words {#related-words}

- [Hreflang](https://ursy.com/wiki/hreflang/)
- [International SEO](https://ursy.com/wiki/international-seo/)
- [Localisation](https://ursy.com/wiki/localisation/)
- [ccTLD](https://ursy.com/wiki/cctld-country-code-top-level-domain/)
- [International keyword research](https://ursy.com/wiki/international-keyword-research/)

## Sources {#sources}

- [Google Search Central: Tell Google about localized versions of your page](https://developers.google.com/search/docs/specialty/international/localized-versions), checked 25 November 2026
- [Google Search Central: Managing multi-regional and multilingual sites](https://developers.google.com/search/docs/specialty/international/managing-multi-regional-sites), checked 25 November 2026
- [MDN: lang global attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang), checked 25 November 2026
- [W3C Internationalization: Declaring language in HTML](https://www.w3.org/International/questions/qa-html-language-declarations), checked 25 November 2026

*Updated 25 November 2026 by URSY.*
