Skip to main content
← All guides

Hreflang

Hreflang tells an engine that several pages are the same content for different audiences, so it can serve the right one. It is a signal it may decline to follow, not a directive it must obey.

Four rules that keep the set interpretable

Hreflang is a cluster of annotations, so errors on one side can affect how Google interprets the relationship. Google says missing return links or otherwise invalid annotations may be ignored or interpreted incorrectly; it does not promise that one mistake always voids the entire cluster.

  • Complete: every version in the group lists every other version.
  • Mutual: if X points to Y, Y should point back to X. Missing return links can cause annotations to be ignored or interpreted incorrectly.
  • Self-referencing: each page lists itself alongside the others.
  • Valid: the codes must parse as real language and region codes.

The mutuality rule is the one that catches teams, because hreflang describes relationships between pages rather than a property of one page in isolation. Roll out corresponding return links together so each published relationship is complete when Google crawls either side.

Where to put the annotations

Three placements are available and they are equivalent in effect. Pick one and use it everywhere — mixing them across a site is how sets end up half-declared.

MethodBest forWatch out for
HTML link elementsSmall to mid-size sitesPage weight when there are many versions
HTTP headersPDFs and other non-HTML filesHeader size limits on large sets
Sitemap entriesLarge sites, many localesKept in sync with the pages themselves
HTML link elements
<link rel="alternate" hreflang="en" href="https://example.com/guide/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/guide/" />
<link rel="alternate" hreflang="pt-br" href="https://example.com/pt-br/guide/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/guide/" />

Note that the English page in that sample lists itself. That is the self-reference, and its absence is the single most common defect in otherwise careful implementations — because it looks redundant and reads like a mistake to anyone tidying the template.

Codes, and the ones that don't exist

Language is ISO 639-1. It may optionally be followed by a dash and an ISO 3166-1 Alpha 2 region. A region on its own is never valid: there is no way to say "this page is for Canada" without saying which language it is in.

CodeVerdictWhy
enValidLanguage only — English, any region
en-GBValidEnglish as written for the United Kingdom
GBInvalidRegion without a language
ukValid, but not the UKuk is Ukrainian; the UK is GB
euInvalid as a regionThe EU is not a country code
en-UKInvalidThe country code for the UK is GB

What x-default is for

x-default catches the languages you did not list. It is the fallback for a visitor whose language matches none of your versions, and its natural home is a selector page or a home page that routes visitors by itself.

It is not a way to nominate a primary version. Pointing x-default at your English page because English feels like the default tells the engine that English is what an unmatched Japanese or Turkish visitor should get, which may be true and is worth deciding deliberately rather than by habit.

Hreflang and canonical are different jobs

These two get tangled more than any other pair in technical SEO, and the failure mode is severe. A canonical says "index this other URL instead of me". Hreflang says "this other URL is the same content for a different audience".

Point the canonical of your German page at the English one and you have told the engine the German page should not be indexed at all — which removes it from the results, and simultaneously breaks the hreflang set that referenced it. Each localised page should canonicalise to itself, and use hreflang to describe its siblings.

Try it on your own site

Questions and answers

Does hreflang fix duplicate content across languages?

It is a targeting signal, not a duplicate-content fix. Translations are not duplicates; hreflang tells the engine which translation belongs to which audience.

Why is the wrong language version ranking?

Usually an incomplete return-link set or codes that fail validation. Because hreflang is a signal, a set the engine distrusts gets set aside and it falls back to its own language detection.

Do I need hreflang if all my pages are in one language?

Only if you target several regions with it — en-GB and en-US, say, where the content differs by market. A single site in a single language for one audience needs nothing.

Should each page canonicalise to itself or to the original language?

To itself. Canonicalising a translation to the source language tells the engine not to index the translation, which removes it from results and breaks the hreflang set that pointed at it.

Where should x-default point?

At whatever should serve a visitor whose language you do not publish — usually a selector page or a self-routing home page. It nominates a fallback, not a primary version.

Is hreflang a ranking factor?

No. It is a targeting signal that helps the right version reach the right audience. It does not raise how a page ranks, and Google may decline to follow the annotations at all.