What is hreflang?
Hreflang tells Google which language or regional version of a page to show each searcher. The syntax, x-default, and the mistakes that break it.
Updated
Hreflang is an attribute that tells Google about the language and regional versions of a page, so it can show each searcher the right one: the French page to French speakers, the UK page in the UK. It doesn’t raise rankings; it helps the right version appear in place of the wrong one.
What does hreflang look like?
<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />- The value is a language code (ISO 639-1, such as
fr), optionally followed by a region code (ISO 3166-1 Alpha 2, such asgb). x-defaultnames the page for everyone else, such as a language picker or your main version.- You can also declare hreflang in an XML sitemap or, for non-HTML files, in HTTP headers.
What mistakes break hreflang?
- Missing return links: if page A lists page B, page B must list page A. Google ignores one-way annotations.
- Wrong codes:
en-ukinstead ofen-gb, or a region with no language such asus. - Pointing at the wrong URL: redirected, noindexed or non-canonical pages.
- Each version’s canonical tag should point to itself, not to one shared “main” language version.
Example
A shoe store sells in the US and UK with near-identical English pages. Without hreflang, Google may treat them as duplicates and show US prices in dollars to UK searchers. Hreflang en-us and en-gb with return links tells Google they are deliberate regional versions.
SEO Rank Fixer’s Site Audit checks hreflang codes on pages that use them.