Search 4 min read Updated
hreflang for multilingual sites
In short
Hreflang works when every version lists itself and every other version, using valid language and region codes.
A shop with several language versions wants each visitor to land on the right one. Hreflang tells search engines which version to show, but it works only when the versions point to each other correctly. Most failures come from missing return links or wrong codes, so check those first.
Pick one of the three methods and stick to it
Three methods are accepted: link elements with rel=alternate and an hreflang attribute in the head of each HTML page, a Link header in the HTTP response, or xhtml:link entries under each url element in an XML sitemap. All three count the same, so choose one and use it across the site. Using all three adds maintenance work without any search benefit.
- HTML head: the annotations sit in the head of each page;
- HTTP header: suits files that are not HTML, such as PDFs;
- XML sitemap: keeps the whole set of alternates in one file.
The full guidance is in Google’s Localized versions of your pages.
Every version must link back to every other
Each version must list itself and every other version, and the set must be identical on every version. If two pages do not point to each other, Google ignores the annotations. The rule also stops other sites from claiming your pages as their alternates.
Check both directions before you deploy. A typical failure is a German page that links to its Slovak alternative while the Slovak page does not link back. When it chooses a canonical, Google prefers URLs inside a reciprocal hreflang cluster; the details are in Consolidate duplicate URLs.
Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea
A region code cannot stand alone
A value has a language code in ISO 639-1, optionally followed by a region code in ISO 3166-1 alpha-2, separated by a hyphen. For example, en-GB and sk-SK are valid. Case does not matter, although uppercase region codes are the convention.
A region on its own is not enough. The value be means Belarusian, not Belgium, so Belgium needs a language as well, for example fr-BE. The United Kingdom uses GB, not UK, and Google ignores the reserved codes EU, UN and UK. Script subtags such as zh-Hant are supported, but Google does not support codes outside ISO 639-1 and ISO 3166-1 Alpha 2, such as es-419, even though they are valid BCP 47 tags. Use the same codes on every version. A shop with en-GB and en-US pages must use these same two codes in every page set, or the annotations will not match.
x-default belongs on the language selector
The x-default value marks the page to show when no other version matches the visitor’s browser language setting. It needs no language code. It works best on a language selector page, or on a page that redirects users by language, because those pages have no language of their own.
A language selector is a sensible fallback, because the visitor chooses the version they need.
Mistakes to check first
| Mistake | What goes wrong | Fix |
|---|---|---|
| Missing return link | Google ignores the annotations for that pair | On every version, list all versions, so each pair points both ways |
| Region code alone | be is read as Belarusian | Put a language code before the region code |
| Reserved region code | EU, UN and UK are ignored | Use GB for the United Kingdom |
Before release, open each version in a browser, read the alternates in the page source, and compare the set across versions in one spreadsheet. Check the cluster again after each deployment. For the duplicate-address side of the same question, read canonical URLs when one page has many addresses, and for the sitemap version of the same annotations, see XML sitemaps that help search engines.
Common questions
- Do I need hreflang on a site with one language?
- No. Hreflang matters only when the same content exists in several language or regional versions. A site with one version has nothing to match.
- Does hreflang choose the right version for each user?
- It helps Google show the language or regional version that suits each user, but it works only when every version links back to the others and uses valid codes.
- What is the x-default value for?
- The x-default value marks the fallback page for visitors whose language setting matches none of your versions. A language selector page is a common choice for it.
Sources
- Tell Google about localized versions of your page, Google Search Central. Accessed 24 November 2026
- How to specify a canonical URL with rel=“canonical” and other methods, Google Search Central. Accessed 24 November 2026
Further reading
-
Breadcrumbs and their structured data
Each breadcrumb step needs a position, a name and a URL, and the visible trail should match the markup.
-
XML sitemaps that help search engines
An XML sitemap helps search engines find the pages you want considered, within the protocol limits of 50,000 URLs and 50 MB per file.
-
Domains, subdomains or folders for countries
Choose a country domain, a subdomain or a subdirectory for each market, and then set the target explicitly with hreflang and clear signals.
Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea