What is Hreflang tags?
Hreflang tags are HTML attributes that tell search engines which language and region each version of a page is meant for, so the right version appears for each searcher.
A hreflang tag uses language codes, and optionally region codes, such as en-gb for English in the UK, en-au for English in Australia or fr-ca for French in Canada. Each version lists all the other versions, including itself.
Tags can sit in the page head, in HTTP headers or in the XML sitemap. An x-default tag points to the fallback version for users who do not match any listed language or region.
Hreflang tag syntax
Each language or country version lists every version, including itself. Codes use ISO 639-1 for language and ISO 3166-1 Alpha 2 for country.
<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-ca" href="https://example.com/ca-fr/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
x-default tells search engines which page to show when no version matches the user, often a language selector or global home page.
Three ways to add hreflang
| Method | Best for | Watch out for |
|---|---|---|
| HTML link tags in the head | Small and medium sites | Large tag blocks on every page |
| HTTP headers | PDFs and non HTML files | Harder to audit |
| XML sitemap | Large sites with many versions | Sitemaps must stay in sync with live URLs |
Common hreflang errors
Missing return links
If page A points to page B, page B must point back to page A, or the pair can be ignored.
Invalid language or country codes
"en-uk" is invalid; the UK code is "en-gb". Country alone, like "gb", is also invalid.
Pointing to redirected or noindexed URLs
Every hreflang URL should return 200 and be indexable.
Conflicting canonicals
Each version should canonical to itself, not to another language version.
Same content in every version
Localise currency, spelling, contact details and examples, not just the language code.
Why hreflang tags matter
Hreflang tags tell search engines which language and country each version of a page targets, such as en-us, en-gb or fr-ca. They help Google show the right version to each user, reducing cases where a UK visitor lands on a US page with dollar prices. They do not boost rankings directly, but they improve relevance and user experience on international sites.
Hreflang only works when every version lists all the others, including itself. Missing return links are the most common error.
Hreflang setup steps
- 1List every language and country version of each page.
- 2Choose correct language and optional region codes.
- 3Add hreflang tags in the head, HTTP headers or sitemap.
- 4Include a self referencing tag on each page.
- 5Add x-default for a global or selector page.
- 6Validate with a crawler or hreflang testing tool.
- 7Check Search Console for indexing issues by country.
Hreflang code tips
Use ISO codes
Language codes like en and region codes like GB.
Match canonicals
Each version should be self canonical.
Use full URLs
Absolute URLs avoid errors.
Hreflang checklist
- 1All versions listed on each page.
- 2Self referencing tag present.
- 3Valid language and region codes.
- 4x-default added.
- 5Canonical matches the page.
- 6Errors checked regularly.
Hreflang for one language in several countries
English sites serving the US, UK and Australia can use en-us, en-gb and en-au versions when prices, spelling or offers differ. If content is identical, one version may be enough.
Why Hreflang tags matters for SEO
Without hreflang, Google may show the wrong country or language version, such as US prices to UK visitors, which hurts conversions.
Hreflang also stops similar English pages for different countries being treated as duplicates, so each one can rank in its own market.
How Hreflang tags works
Hreflang only works when every version is set up correctly.
Choose codes
Use ISO 639-1 language codes and ISO 3166-1 region codes, such as de-ch for German in Switzerland.
Link every version both ways
Each page must list all alternates, and each alternate must link back. Missing return links make Google ignore the tags.
Add an x-default
Point x-default to a language selector or global page for everyone else.
A software firm has English pages for the USA, UK and Australia with different prices. Adding hreflang for en-us, en-gb and en-au, plus x-default, means Australian searchers see AUD pricing in Google and bounce less.
Hreflang tags checklist
- ✓Use correct ISO language and region codes
- ✓Include a self referencing hreflang
- ✓Make every link reciprocal
- ✓Point hreflang only to canonical, indexable pages
- ✓Add an x-default version
- ✓Check errors in a crawler or Search Console
Common Hreflang tags mistakes
Wrong codes
Using en-uk instead of en-gb makes the tag invalid.
Missing return tags
If page B does not link back to page A, Google ignores the pair.
Pointing to redirects
Hreflang should point to final, indexable URLs.
Relying only on hreflang
Pages still need translated or localised content, not only tags.
Related SEO terms
Hreflang tags FAQs
What does hreflang do?
+
It tells search engines which language and region a page targets so the right version appears in results.
Where do I add hreflang tags?
+
In the page head, HTTP headers or XML sitemap. Choose one method and use it consistently.
What is x-default?
+
The fallback version shown when no other language or region matches the user.
Can hreflang fix duplicate content between countries?
+
It helps Google understand similar pages are alternates for different markets, which reduces duplicate issues.
Can hreflang be added in an XML sitemap?
+
Yes. Sitemap hreflang is useful for large sites where editing every page head is difficult.
Is hreflang a ranking factor?
+
No, it helps Google choose which version to show, not how high it ranks.
Do I need hreflang for one language?
+
Only if you have different versions of that language for different countries.
Does Bing use hreflang?
+
Bing relies more on the content-language meta tag and other signals.
How long does hreflang take to work?
+
Google needs to crawl all versions, which can take weeks on large sites.
Does hreflang work across different domains?
+
Yes. Hreflang can connect versions on country domains like example.de and example.fr.