Hreflang

Hreflang is an HTML attribute that tells search engines which language and, optionally, which country each version of a page is meant for. It helps Google show the right version to the right searcher, such as the UK English page to people in London and the Spanish page to people in Madrid.

When you need hreflang

  • Your site has the same content in several languages.
  • You have separate versions for countries that share a language, such as the UK, US and Australia, with different prices, spelling or delivery details.
  • You run several country domains, such as .co.uk, .de and .fr, with equivalent pages.

If your site is only in one language for one market, you do not need hreflang.

How hreflang works

Each version of a page lists all the alternative versions, including itself. For example, a UK page might reference:

  • en-gb for the UK English page.
  • en-us for the US English page.
  • es for the Spanish page.
  • x-default for the fallback page shown to users who match none of the others.

Language codes use the ISO 639-1 format (en, de, es) and optional region codes use ISO 3166-1 Alpha 2 (GB, US, DE). Note that the UK code is GB, not UK.

Three ways to add hreflang

  1. Link tags in the HTML head of each page.
  2. HTTP headers, useful for PDFs and other non-HTML files.
  3. XML sitemaps, which keep annotations out of page code and suit large sites.

Use one method consistently rather than mixing them.

The rules that cause most errors

  • Return links: if page A points to page B, page B must point back to page A. Missing return links make Google ignore the annotation.
  • Self-reference: each page must include itself in the list.
  • Indexable, canonical URLs only: hreflang should point to pages that return 200 and are not noindexed or canonicalised elsewhere.
  • Matching canonicals: each language version should have a self-referencing Canonical Tag, not a canonical pointing to another language.
  • Correct codes: invalid codes, such as en-uk, are ignored.
  • Absolute URLs including https.

Hreflang and duplicate content

Pages in the same language for different countries are often almost identical. Hreflang tells Google they are intentional regional variants rather than Duplicate Content, so it shows the right one in each country instead of picking just one. Adding real local differences, such as currency, contact details and spelling, strengthens this.

How to check hreflang

Crawl your site with an SEO crawler that validates hreflang, and look for missing return tags, wrong codes and non-canonical targets. Check country-specific performance in Google Search Console to see whether the right page appears in each market.

Beyond hreflang

Hreflang does not translate or localise anything; it only labels pages. Successful international sites also need localised content, local links and the right site structure. See International SEO for the full picture.

Further reading: Google on localised versions of your pages.

Key Takeaways

  • Hreflang tells Google which language and country each page version targets.
  • Every page must reference itself and all alternates, with return links.
  • Use valid codes, such as en-gb, not en-uk.
  • Point hreflang only to canonical, indexable URLs.
  • Hreflang labels pages; it does not localise content.

Related Terms

Need a second opinion on your website? Ask for a free website SEO check, or keep learning in the SEO Encyclopedia.