If your site has versions of the same page for different languages or countries, hreflang tells Google which version to show to which searcher. Without it, a UK visitor might land on your US page, or a Spanish speaker on the English one. Create correct tags for each version with the hreflang tag generator.
Quick answer: Hreflang is an annotation that lists all language and regional versions of a page. Each version must list every version including itself, and links must be reciprocal: if page A points to page B, B must point back to A. Use language codes such as en or ar, optionally with a region, such as en-GB or ar-AE; a country code alone is invalid. Add an x-default for visitors whose language isn't matched. You can put hreflang in the HTML head, in HTTP headers or in your sitemap. It changes which URL is shown, not how high it ranks.
When you need hreflang
- The same content in different languages, such as English and Urdu.
- The same language for different countries with different prices, spelling or rules, such as en-GB and en-US.
- A mix of both on larger international sites.
You don't need it for a single-language site aimed at one country.
Codes
| Value | Meaning |
|---|---|
| en | English speakers anywhere |
| en-GB | English speakers in the United Kingdom |
| en-AE | English speakers in the United Arab Emirates |
| ar | Arabic speakers anywhere |
| zh-Hant | Chinese in traditional script |
| x-default | Fallback for unmatched languages or regions |
Languages use ISO 639-1 codes and regions use ISO 3166-1 alpha-2. The UK is GB, not UK.
An example
Each of the three pages below would include all three lines plus x-default in its head:
- link rel=alternate hreflang=en-GB pointing to example.com/uk/
- link rel=alternate hreflang=en-US pointing to example.com/us/
- link rel=alternate hreflang=de pointing to example.com/de/
- link rel=alternate hreflang=x-default pointing to example.com/
Three ways to add it
| Method | Best for |
|---|---|
| HTML link tags in the head | Most sites with a manageable number of versions |
| HTTP headers | Non-HTML files such as PDFs |
| XML sitemap | Large sites with many versions, to keep page code light |
Pick one method per page to avoid conflicting signals. Build sitemaps with the XML sitemap generator.
Hreflang and canonicals
Each language version should have a self-referencing canonical. Don't canonicalise all versions to one language, or Google may ignore the alternates. See canonical tags explained.
Common mistakes
- Missing return links, so annotations are ignored.
- Using country codes alone, such as hreflang=uk.
- Pointing to URLs that redirect, return 404 or are blocked by robots.txt.
- Forgetting the self-reference.
- Automatically redirecting visitors by IP address, which can stop Google seeing all versions. Offer a language selector instead.
- Translating only menus while the main content stays the same; Google may treat such pages as duplicates.
Check each URL returns 200 with the HTTP status code checker. More tools are in the SEO tools guide.
Based on Google Search Central documentation as at November 2026.
Frequently asked questions
What is hreflang?
An annotation that tells Google about language and regional versions of a page so it can show the right one to each searcher.
Does hreflang improve rankings?
No. It helps Google show the most suitable version of a page, not rank it higher.
What is x-default in hreflang?
A fallback version for visitors whose language or region doesn’t match any listed version, often a language selector page.
Is hreflang=uk correct for the United Kingdom?
No. Use en-GB. Region codes must follow a language code, and the UK’s code is GB.
Do hreflang tags need to be reciprocal?
Yes. Every version must link to every other version and to itself, or Google may ignore the annotations.
Should I use hreflang in HTML or a sitemap?
Either works. HTML suits smaller sites; sitemaps suit large sites with many versions. Use one method consistently.
Sources
- Google Search Central: Tell Google about localized versions of your page
- Google Search Central Blog: How x-default can help you
- specification.website: hreflang for language and regional URLs
Last updated: