Hreflang
Hreflang is an HTML attribute that tells search engines which language and optional region each version of a page targets, so they can show searchers the right one.
Also called: hreflang tag, hreflang attribute, rel alternate hreflang, international SEO tags
Hreflang is an HTML attribute that tells search engines which language, and optionally which country, each version of a page is for. It lets Google show the Spanish page to Spanish speakers and the UK page to UK searchers instead of whichever version happens to rank. For any company selling in more than one language or market, it is the backbone of international SEO.
How it works
Each language or regional version of a page lists every version in the set, including itself, with a code. In the HTML head that looks like:
<link rel="alternate" hreflang="en-us" href="https://example.com/us/pricing" />
The rules that matter:
- Codes: a language code in ISO 639-1 format (en, es, de), optionally followed by a region in ISO 3166-1 Alpha 2 format (us, gb, mx). "en-gb" is valid. "en-uk" is not, and a region on its own is not allowed.
- Return links: if page A lists page B, page B must list page A. Missing return links can cause the annotations to be ignored.
- Self-reference: every page includes itself in its own set.
- x-default: an optional fallback for searchers who match no listed version.
- Canonical alignment: each version should have a self-referencing canonical tag. Pointing all versions' canonicals at one page tells Google to ignore the others.
- Placement: HTML head, HTTP headers or the XML sitemap, one method per set.
Example
Say a SaaS company has pricing pages for the US, UK, Germany and Mexico (assumptions throughout). Without hreflang, the US page outranks the UK page in the UK because it has more links, so British visitors see dollar prices and convert worse.
The setup for each of the four pricing pages lists five entries: en-us, en-gb, de-de, es-mx and x-default pointing to the US page. That is four pages times five lines, or 20 annotations, all reciprocal.
Now the math. Say the UK pricing page gets 1,000 visits a month from search, and UK visitors who land on the UK version convert at 4%, compared with 2.5% on the US version. If hreflang shifts 600 of those visits to the right page, conversions on that traffic go from 15 to 24 a month. Nine extra trials a month from a tagging fix.
When it matters and when it doesn't
Hreflang matters when you have real localized versions: translated pages, different currencies, different legal terms or region-specific offers. It also matters for same-language markets, like the US, UK and Australia, where content is near-identical and search engines otherwise pick one arbitrarily.
It does not matter if you have one English site serving everyone. Do not create thin regional copies just to add hreflang; that creates duplicate content and more technical SEO to maintain without serving anyone better.
Common mistakes
- Using invalid codes like "en-uk" or "es-la," which are silently ignored.
- Forgetting return links, so one side of the pair never confirms the relationship.
- Canonicalizing every regional page to the US version, which cancels the hreflang.
- Pointing hreflang at redirected, noindexed or broken URLs.
- Auto-redirecting visitors by IP, which can stop crawlers from ever seeing the other versions.
- Adding hreflang to a few templates and forgetting blog, docs and help pages.
FAQ
Where do I put hreflang tags?
You can use any one of three methods: link elements in the HTML head of each page, HTTP headers (useful for PDFs and other non-HTML files) or entries in your XML sitemap. Pick one method per set of pages and use it consistently. Sitemaps are often easiest to maintain on large sites.
What is x-default in hreflang?
x-default marks the page to show when no other language or region version matches the searcher. It is usually a global English page or a language selector. It is optional but recommended for most international sites.
Does hreflang stop duplicate content issues?
It helps search engines understand that similar pages are deliberate regional versions, so they show the right one rather than treating them as competing duplicates. It does not combine ranking signals the way a canonical tag does. Each version still needs to be indexable and self-canonical.
Related
Used in these articles
- ArticleInternational SEO: When to Expand and How to Get It Right
- ArticleHow to Sell Internationally on Shopify: Markets, Money, Duties and SEO
- ArticleCanonical Tags: Fix Duplicate Content Without Losing Rankings
- ArticleHreflang for Growing Startups: When You Need It and How to Ship It
- ArticleShopify Sitemap.xml: What's In It and How to Control It
- ArticleShopify Technical SEO: Duplicate URLs, robots.txt and Schema