Technical SEOAdvanced

Hreflang

Hreflang is an annotation telling search engines which language or regional versions of a page exist, so each searcher gets the right one.

Also called: rel=alternate hreflang

Hreflang annotations link together the localized versions of a page and label each with its language, and optionally its region. Search engines use them to show, for example, the German page to German-speaking searchers and the US English page to US searchers. Hreflang does not translate anything or boost rankings; it helps the right version be served among pages that would otherwise compete with each other.

How it is written

Each localized page lists every version, including itself. Values use an ISO 639-1 language code, optionally followed by an ISO 3166-1 alpha-2 region code. The x-default value marks the fallback page for searchers who match none of the listed versions, often a language selector or the main English page.

<link rel="alternate" hreflang="en-us" href="https://www.example.com/pricing" />
<link rel="alternate" hreflang="en-gb" href="https://www.example.com/uk/pricing" />
<link rel="alternate" hreflang="de" href="https://www.example.com/de/preise" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/pricing" />

Three places to put it

Google supports hreflang in HTML link elements, in HTTP Link headers (useful for PDFs), and in XML sitemaps. Pick one method per set of pages. Sitemaps are often easiest at scale, because the annotations are generated in one place rather than in every template.

Rules that trip people up

Most hreflang errors are mechanical and easy to detect with a crawler.

  • Return links: if page A lists page B, page B must list page A, or the pair may be ignored
  • Every URL in a set must be canonical, indexable and return 200
  • Use the right codes: en-uk is wrong, en-gb is right; a region alone is not valid
  • Self-reference: each page includes itself in its own list
  • Keep canonicals self-referencing on each localized page, not pointing to the English original

Other search engines

Google and Yandex document hreflang support. Bing has historically said it relies more on other signals, such as the content-language meta tag and the page's language, so do not assume hreflang alone handles Bing. Google also notes that it does not use hreflang or the HTML lang attribute to detect a page's language; it reads the content.

Example

UK pricing showing to US buyers

A fictional payroll SaaS, Paycrest, has US and UK pricing pages in English with different currencies. Google often shows the UK page to US searchers because the two pages are nearly identical.

Adding hreflang (en-us and en-gb, with x-default on the US page) and clearly localized content such as currency, tax terms and regional compliance notes gives Google what it needs to serve the right version.

Common mistakes

Missing return links

One-way hreflang is the most common error. Generate annotations from a single source so every page in a set lists the others.

Canonicalizing translations to the English page

That tells Google the translations are duplicates and should not be indexed. Each version should canonicalize to itself.

Automatic IP redirects

Forcing visitors (and crawlers) to a local version can stop Google from seeing the other versions. Use a suggestion banner instead.

Questions

No. Hreflang is only useful when you have multiple language or regional versions of the same content.

Include any localized public pages you want indexed, such as docs. Logged-in app pages are not indexed and do not need it.

No. It helps Google choose which version to show, and it can reduce the wrong version ranking, but it does not raise rankings on its own.

Know the terms. Now win the searches.

We find the searches your buyers make, then build, publish and improve the pages that win them.