Free SEO audit for new clients — claim yours
Home/Blog/Technical SEO/Hreflang Tags: A Guide to International SEO
Technical SEO

Hreflang Tags: A Guide to International SEO

Hreflang Tags: A Guide to International SEO
Table of contents
  1. Key Takeaways
  2. What Are Hreflang Tags?
  3. When You Need Hreflang
  4. Hreflang Syntax
  5. Three Ways to Implement Hreflang
    1. HTML example
    2. HTTP header example (for a PDF)
    3. XML sitemap example
  6. The Two Rules That Break Most Setups
    1. 1. Self-reference and return links
    2. 2. Hreflang and canonicals must agree
  7. What x-default Does
  8. How to Implement Hreflang: Step by Step
  9. Common Hreflang Mistakes
  10. Related Guides
  11. Frequently Asked Questions
    1. Is hreflang a ranking factor?
    2. Does Google use hreflang to detect a page's language?
    3. Do I need hreflang if I only have one language?
    4. Is 'en-uk' a valid hreflang value?
    5. Which hreflang method is best?
    6. Does Bing support hreflang?
  12. Conclusion
  13. References

If your website serves more than one country or language, you have probably seen this problem: a customer in London lands on your US page with dollar prices, or a Spanish speaker in Mexico sees your Spain page with the wrong shipping details. Search engines are good at detecting language, but they need help to understand which version of a page is meant for which audience.

That is the job of hreflang. In this guide you will learn what hreflang tags do (and what they do not), the exact syntax Google supports, the three ways to implement them, how x-default works, and how to audit and fix the errors that break most international setups.

Hreflang is one part of a wider technical foundation; our technical SEO guide covers the rest.

Key Takeaways

  • Hreflang tells Google which language or regional versions of a page exist, so it can show the right one to each user.
  • Values use ISO 639-1 language codes, optionally followed by ISO 3166-1 Alpha 2 region codes (for example en-GB).
  • Every version must list itself and all other versions, and links must be reciprocal.
  • Use x-default for a fallback page such as a language selector.
  • Implement via HTML, HTTP headers or XML sitemaps; Google treats them as equivalent.

What Are Hreflang Tags?

Hreflang is an attribute of the <link rel="alternate"> element that tells search engines about alternate versions of a page for different languages or regions. For example, you might have English pages for the US, the UK and Australia, plus a Spanish version for Mexico.

It is important to understand what hreflang is not:

  • It is not a ranking boost; it helps the right version appear for the right user.
  • It is not a language detector. Google determines a page's language algorithmically.
  • It is not a redirect. Users are not moved automatically; search results simply show the best match.

“Google doesn't use hreflang or the HTML lang attribute to detect the language of a page.”

— Google Search Central, Tell Google about localized versions of your page

When You Need Hreflang

  • The same content is translated into multiple languages.
  • The same language is used for different regions with differences in currency, pricing, spelling or legal details (US vs UK English, Spain vs Mexico Spanish).
  • Only part of a page is translated, such as the navigation, while the main content stays the same.

Region variants in the same language are a classic source of duplicate content. Hreflang helps Google understand the pages are alternates, but genuine localisation (prices, contact details, examples) is what makes each version useful.

Hreflang Syntax

Each value starts with an ISO 639-1 language code. You can optionally add a hyphen and an ISO 3166-1 Alpha 2 region code. You cannot specify a region alone.

ValueMeaningValid?
enEnglish speakers anywhereYes
en-GBEnglish speakers in the United KingdomYes
en-UK“UK” is not the ISO region code for the United KingdomNo
es-419Spanish for Latin America (UN M.49 region code)No for Google; use country codes
de-ATGerman speakers in AustriaYes
GBRegion on its ownNo
zh-HantChinese in Traditional scriptYes (script subtag)
x-defaultFallback when no other version matchesYes

Google's documentation states that only ISO 639-1 language codes and ISO 3166-1 Alpha 2 region codes are supported, and that alternate URLs must be fully qualified, including https://.

Three Ways to Implement Hreflang

Google's localized versions documentation says the three methods are equivalent from Google's perspective. Pick the one that best suits your platform and use only one, to avoid conflicting signals.

MethodBest forProsCons
HTML <link> tags in <head>Small to mid-sized sitesEasy to see and debugAdds code to every page; heavy with many locales
HTTP Link headerPDFs and other non-HTML filesWorks without HTMLNeeds server configuration; harder to audit
XML sitemapLarge sites with many localesCentralised, no page bloatLess visible; must stay in sync with URLs

HTML example

This block goes in the <head> of every version listed, unchanged:

<link rel="alternate" hreflang="en-US" href="https://www.example.com/us/pricing/" />
<link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/pricing/" />
<link rel="alternate" hreflang="es-MX" href="https://www.example.com/mx/precios/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/pricing/" />

HTTP header example (for a PDF)

Link: <https://www.example.com/us/guide.pdf>; rel="alternate"; hreflang="en-US",
      <https://www.example.com/uk/guide.pdf>; rel="alternate"; hreflang="en-GB"

XML sitemap example

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://www.example.com/us/pricing/</loc>
    <xhtml:link rel="alternate" hreflang="en-US" href="https://www.example.com/us/pricing/"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/pricing/"/>
  </url>
  <url>
    <loc>https://www.example.com/uk/pricing/</loc>
    <xhtml:link rel="alternate" hreflang="en-US" href="https://www.example.com/us/pricing/"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/pricing/"/>
  </url>
</urlset>

Notice that each <url> entry repeats the full set of alternates. For general sitemap rules, see our XML sitemap guide.

The Two Rules That Break Most Setups

Each language version must list itself as well as all other versions. If page A points to page B but B does not point back to A, Google ignores the annotation. This is why hreflang is best generated from one central mapping rather than edited page by page.

2. Hreflang and canonicals must agree

Each localised page should have a self-referencing canonical. If your UK page canonicalises to the US page, you are telling Google the UK page is a duplicate, which contradicts the hreflang annotation. Hreflang URLs should also point only to canonical, indexable pages that return 200. Our canonical tag explainer covers the basics.

What x-default Does

The reserved x-default value tells Google which page to show when no other language or region matches the user's browser settings. It is typically a language selector page or your main international homepage. It is optional but recommended for any site with a global audience.

How to Implement Hreflang: Step by Step

  1. List your target markets as language or language-region pairs (for example en-US, en-GB, de).
  2. Choose a URL structure: country-code domains, subdomains or subfolders. Subfolders on one domain are usually easiest to manage.
  3. Build a mapping table linking each page to its equivalent in every locale.
  4. Choose one implementation method (HTML, header or sitemap) and generate tags from the mapping automatically.
  5. Add x-default pointing at your fallback page.
  6. Check canonicals are self-referencing on each locale.
  7. Audit with a crawler that validates return links and codes, and monitor performance by country in Search Console.

Common Hreflang Mistakes

  • Missing return links, so annotations are ignored.
  • Invalid codes such as en-UK or en-EU, or region-only values.
  • Relative URLs such as /uk/ instead of fully qualified URLs.
  • Pointing to redirected, 404 or noindexed URLs. Every target should be a live canonical page.
  • Canonicalising all locales to one version, which cancels out the hreflang setup.
  • Forcing automatic IP-based redirects. Google's multi-regional guidance recommends against automatically redirecting users based on perceived language; let users switch versions with clear links instead, and avoid hiding versions from Googlebot, which mostly crawls from the US.
  • Translating only the template. If the main content is identical, the versions offer little distinct value.

Frequently Asked Questions

Is hreflang a ranking factor?

No. Hreflang does not boost rankings. It helps Google show the most appropriate language or regional version of a page to each user, which can improve click-through and conversions.

Does Google use hreflang to detect a page's language?

No. Google says it does not use hreflang or the HTML lang attribute to detect language; it uses its own algorithms. Hreflang tells Google which alternate versions exist.

Do I need hreflang if I only have one language?

Usually not. Hreflang is for sites with multiple language or regional versions of the same content. A single-language site targeting one market does not need it.

Is 'en-uk' a valid hreflang value?

No. The ISO 3166-1 Alpha 2 code for the United Kingdom is GB, so the correct value is en-GB. Hreflang values are case-insensitive, but the codes themselves must be valid.

Which hreflang method is best?

Google treats HTML tags, HTTP headers and sitemaps as equivalent. HTML tags suit small sites, sitemaps suit large sites, and HTTP headers are for non-HTML files such as PDFs.

Does Bing support hreflang?

Bing has historically relied more on signals such as the content-language meta tag and the HTML lang attribute. If Bing traffic matters, set those correctly alongside hreflang.

Conclusion

Hreflang is fussy but logical. Use valid ISO codes, fully qualified URLs, a complete and reciprocal set of alternates on every version, self-referencing canonicals and an x-default fallback. Generate it from one central mapping and audit it after every release. Pair it with genuinely localised content, and international visitors will land on the page that was built for them. Include hreflang checks in every technical SEO audit, and keep an eye on crawl efficiency as locale counts grow.

Expanding into new markets? Our enterprise SEO team plans and implements international SEO, from URL structure to hreflang at scale. Get a free quote to discuss your rollout.

References

  1. Google Search Central: Tell Google about localized versions of your page
  2. Google Search Central: Managing multi-regional and multilingual sites
  3. Google Search Central: What is URL canonicalization
  4. ISO 639 language codes
  5. ISO 3166 country codes
  6. Semrush: Common Hreflang Errors and How to Fix Them
Rohit Choudhary
Written byRohit ChoudharyCo-Founder, My SEO Experts

Rohit Choudhary is the co-founder of My SEO Experts and has more than 14 years of hands-on experience in SEO, paid advertising and digital marketing. Since starting out in 2011 he has helped hundreds of businesses grow through practical, data-driven search strategies, and he also serves as a consulting Digital Marketing Director for several US-based companies.

Keep reading

Related articles

Ready to grow your business online?

Get a free, no-obligation proposal tailored to your goals and budget.

CallFree Quote