Skip to content

Technical pillar / check hreflang

hreflang: do language versions of a page point to each other correctly?

When a page lists its language or regional versions with hreflang links, we check that every value is one Google accepts, that every address is a full URL, that the set lists this page itself, and that it lists an x-default fallback. A site in one language needs no hreflang and passes.

By , Founder and CEO, Own The Climb · Last updated

This is how we check it

We check the hreflang annotations on this page for valid codes, full addresses, a self-reference and x-default. We also follow up to five of the other versions to check that each links back.

  • We read every hreflang link in the head of the HTML your server sends.
  • We check whether each value is a valid language code, with a region only where it fits, such as en, en-GB or es-MX.
  • We check whether the set includes the page itself and an x-default, and uses full addresses.
  • A site in one language needs no hreflang links, so having none passes.

Our reasoning behind this

Google uses hreflang to show each searcher the version of a page in their language or for their region. A wrong code or a one-way link means a searcher can land on the wrong version.

How we would fix it on your site

  1. On every language version of a page, list all the versions, including the page itself, with full https:// addresses.
  2. Write each value as a language code, adding a region only if the page targets a country.
  3. Add one hreflang="x-default" link for the version to show when no other matches.

Once your change is live, run the audit again and review the new findings alongside the pages it covered.

How to make the change on your platform

What to do on each platform
PlatformWhat to do
WordPressMultilingual plugins such as WPML and Polylang write hreflang for every translated page. Check their language settings for the region codes they output.
ShopifyShopify Markets and the Translate & Adapt app add hreflang for each published language and market.
WixWix Multilingual adds hreflang for each language you publish.
Next.jsSet alternates.languages in each page's metadata, with an x-default key, and Next.js prints the links.

What we want you to review

  • Use en-GB for British English; UK is not the region code used in that value.
  • Start each hreflang value with a language code; a country-only value such as us is incomplete.
  • Return the link from the alternate-language page when you link to it; Google requires reciprocal links.
  • Point hreflang at the final address with the intended canonical.

The exact rules our audit applies

We wrote this part for your developer or your SEO specialist. It sets out the inputs, scoring rules and confidence limits we publish for this check, together with the full explanation of how we would fix a finding.

The inputs we describe for this check

Every <link rel="alternate" hreflang="..." href="..."> in the <head> of the HTML your server sends. A link in the page body, or after an element that ends the head early (an <img>, a <div> or stray text before </head> closes the head in browsers), is named in the finding but not counted, because Google says hreflang links "must be inside a well-formed <head> section".

Each value must be a two-letter ISO 639-1 language code, optionally followed by a four-letter script code and a two-letter region code (en, en-GB, es-MX, zh-Hant, zh-Hant-TW), or x-default. Three-letter language codes such as fil are not ISO 639-1 codes, and Google does not support them. Upper and lower case are both accepted.

A value with the region UK, EU or UN is reported as invalid: the United Kingdom's ISO 3166-1 code is GB, and Google asks for officially assigned ISO 3166-1 Alpha 2 region codes.

So is any other region code ISO has not officially assigned (retired codes such as DD, reserved ones such as EZ or AC, private-use ones such as XA or XK) and any withdrawn language code (iw, in, ji, jw, mo, bh), because Google asks for officially assigned codes.

Each href must be a full URL that starts with https:// or http://, and one of them must be this page itself; a tracking parameter such as utm_source in the address you entered does not count against it. We then check whether an x-default link is present.

We do not fetch the alternate pages, so we do not check that they link back, and we do not read hreflang sent in sitemaps or HTTP headers.

We also follow up to 5 of the other language versions the page lists, x-default first, within the audit's shared link budget: each must answer 200 at the listed address, be indexable, name itself as canonical, and list this page among its own hreflang links.

Our full reasoning

Google uses hreflang to show searchers the version of a page in their language or for their region.

Its guide says the value is "the language code (in ISO 639-1 format) followed by an optional second code that represents the region code (in ISO 3166-1 Alpha 2 format)", that a script can be set with an ISO 15924 code such as zh-Hant, that "The hreflang value is case-insensitive", and that "You can't specify the country code by itself".

It reserves x-default for the page to show "when no other language/region matches the user's browser setting". It also says each language version "must list itself" as well as all the others, and that "If two pages don't both point to each other, the tags will be ignored".

A value Google cannot read is ignored, so a searcher in Mexico can be shown your Spanish page for Spain, or your English page.

How we score what we find

Measured, on every page we read. No hreflang links pass, because a site in one language does not need them. A page whose only hreflang links are outside the head is a MEDIUM finding at MEDIUM confidence that names where they sit; when Next.js streams the page's metadata into the body, the finding quotes both Google and Next.js, which says Googlebot reads streamed metadata, and gives the framework fix.

One or more invalid values is a MEDIUM technical finding, listing up to five of them: a value must be a current ISO 639-1 language, optionally a real ISO 15924 script and an officially assigned ISO 3166-1 region, so a made-up code such as zz-ZZ fails, and so does a retired one such as de-DD.

An hreflang link to a relative address, or a set that does not list this page itself, is a MEDIUM finding too, because Google requires full URLs and a self entry. Valid values without an x-default link is a LOW finding at MEDIUM confidence, because x-default is an optional fallback in Google's guide, and we cannot tell whether you meant to leave it out.

Valid values with x-default pass, and the pass says what it checked: the codes, full URLs and the self entry on this page. The pass also says how many of the other language versions we followed, and that each links back.

An alternate that is not there, does not link back, redirects, asks not to be indexed or names another canonical is a MEDIUM finding that lists each one, because Google ignores hreflang pairs that do not point at each other.

How sure we are of each result

HIGH for invalid values, quoted from the HTML. MEDIUM for a missing x-default. Hreflang declared only in your sitemap or in HTTP headers is invisible to this check and reads as a single-language page; Google accepts all three methods.

How to fix it, in full

On every language version of a page, list all the versions, including the page itself, with <link rel="alternate" hreflang="..." href="..."> in the <head>, using full https:// addresses. Write each value as a language code, then a region code only if the page targets a country (en, en-GB, en-US, es-MX).

Add one hreflang="x-default" link to the page that should be shown when no version matches, such as a language picker or your main version. Make sure every listed address returns 200 and names itself as canonical. Then re-run the audit.

The sources we rely on

What we have changed on this page

  • · We now follow up to 5 of the other language versions a page lists (x-default first) and check that each answers 200, is indexable, names itself as canonical and links back to this page. A missing return link, a missing page, a redirect or a non-indexable alternate is a MEDIUM finding.
  • · Rewritten in plain words: what we check, why it matters and how to fix it come first, and the full rules sit one click down. We corrected the full rules to describe only what we check today.
  • · A region code that ISO has not officially assigned, such as DD (retired), XA or XK (private use) or EZ and AC (reserved), and a withdrawn language code such as iw or in, now fail. Our language data still knew these codes, while Google reads only officially assigned ones.
  • · hreflang links are read only from the <head>, as Google requires. Links in the page body, or after an element such as an <img> or a <div> that ends the head early, are named where they sit and not counted. Next.js metadata streamed into the body is named as such, with the framework fix. A valid set in the head with more links outside it is a LOW finding that names the languages left out, because the pages they name lose the return link from this page.
  • · A tracking parameter such as utm_source in the address you entered no longer fails the self entry, and this page now describes the full-URL and self-entry checks in every section.
  • · Made-up codes such as zz-ZZ now fail, relative hreflang addresses and a set that does not list the page itself are now findings, and a pass says what it checked.
  • · Initial publication. The check now reads hreflang values without regard to case and accepts a script code, as Google does, so en-gb and zh-Hant are valid. It flags a region written as UK, which is not a country code.