Hreflang Tags: How to Set Them Up and Fix Common Errors

Hreflang tags tell Google that several pages are versions of the same content for different languages or countries, so it can show each searcher the right one. They only work when every version lists all the others and itself, with valid codes, pointing to indexable pages.

When hreflang is missing or broken, the symptom is the wrong version ranking: the US page showing in the UK, or the English page in Quebec.

What hreflang tags look like

<!-- The same block goes on all three pages -->
<link rel="alternate" hreflang="en-us" href="https://example.com/pricing" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/pricing" />
<link rel="alternate" hreflang="fr-ca" href="https://example.com/fr-ca/pricing" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />

Each line names one version. The block is identical on every page of the set, which is what makes the links reciprocal. x-default is the fallback for anyone who matches none of the listed versions.

Codes for the most common English and French markets

Valid hreflang values by market
MarkethreflangCommon mistake
United Statesen-usus alone
United Kingdomen-gben-uk
Irelanden-ieSharing the UK page without a tag
Canada, Englishen-caOnly the French version tagged
Canada, Frenchfr-cafr, which also targets France
Australiaen-auReusing the UK page for Australia
New Zealanden-nzSending NZ to the Australian page
Any English speakerenCombining it with every country code needlessly

How to set up hreflang

  1. List the sets of equivalent pages. Hreflang connects versions of the same page. The US pricing page, the UK pricing page and the French Canadian pricing page are one set.
  2. Choose the codes. Language alone (en, fr) when the page serves every country that speaks it; language plus region (en-gb, fr-ca) when prices, spelling or laws differ by country.
  3. Add x-default. The page for visitors who match no listed version, often the main English version or a country selector.
  4. Pick one method. HTML link tags for most sites, the XML sitemap for large sites, HTTP headers for PDFs and other files.
  5. Generate it from one source. Hreflang written by hand breaks as pages are added. The CMS, a plugin or the build should produce every block from the same list.
  6. Check with a crawler. Screaming Frog and the main audit tools report missing return links, invalid codes and non-200 alternates across the whole site.

For large sites, the same information can live in the XML sitemap instead of the pages:

<url>
  <loc>https://example.com/pricing</loc>
  <xhtml:link rel="alternate" hreflang="en-us" href="https://example.com/pricing" />
  <xhtml:link rel="alternate" hreflang="en-gb" href="https://example.com/uk/pricing" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />
</url>
<!-- repeat a <url> entry for /uk/pricing with the same links -->

Common hreflang errors and how to fix them

Hreflang errors, what they cause and the fix
ErrorWhat happensFix
No return linkPage A lists page B, but B does not list A, so Google ignores the pairPut the same complete block on every page of the set
Wrong codesen-UK, en-EU or es-LA are not valid and are ignoredLanguage in ISO 639-1, region in ISO 3166-1: en-GB, es-MX
Region without languagehreflang="gb" is ignoredAlways start with the language: en-gb
Pointing to redirects or 404sThe alternate URL is not a real pageUse the final, indexable 200 URL of each version
Canonical to another languageEach version declares the US page as canonical, so only one is indexedEvery version is canonical to itself
Missing self-referenceThe page lists the others but not itselfInclude the page's own URL in its block
Mixed methods that disagreeHTML says one thing, the sitemap anotherPick one method and generate it from one source

A canonical pointing across languages is the most damaging of these: Google keeps one version and drops the rest, reported in Search Console as "Duplicate, Google chose different canonical than user".

When you do not need hreflang

Hreflang is for equivalent pages. Pages written for different markets that are not translations of each other do not form a set. This site has separate pages for the UK, Canada and New Zealand, each written for its own market, so each one declares only its own language and region instead of pointing to the others.

The UK and Canada pages cover the market-specific cases in depth: sites for the UK and Ireland, and bilingual English and French sites selling into Quebec.

Questions about hreflang

What is hreflang used for?

Hreflang tells Google which version of a page to show to people in each language or country. It does not improve rankings by itself; it makes sure that someone in London gets the UK page with prices in pounds instead of the US page, when both exist.

Is it en-UK or en-GB in hreflang?

en-GB. Region codes follow ISO 3166-1, where the United Kingdom is GB. en-UK is not a valid code and Google ignores it. Codes are not case-sensitive, so en-gb works too.

Do I need hreflang for a site in one language?

No. Hreflang is only for pages that exist in several language or country versions. A site in English only, even with visitors in many countries, does not need it.

Does hreflang need to be on every page?

On every page that has alternate versions, yes, and each page must list all the versions, including itself. Pages with no equivalent in another language do not need it.

How do I check hreflang errors in Google Search Console?

Google retired the International Targeting report, which used to show hreflang errors, in 2022. Use a crawler like Screaming Frog or an audit tool to find missing return links and invalid codes, and URL Inspection to see which canonical Google chose for each version.

The wrong country version ranks?

Send the site and the countries or languages it serves. I reply with what Google sees in your hreflang and what to fix.

Your details are only used to reply to you.

Page updated on .