NitroSERP

March 8, 2026·5 min read·By NitroSERP Editorial Team

Updated

Hreflang Tags: 2026 Setup, ISO Codes & x-default Guide

Implement hreflang correctly with reciprocal return links, valid language and region codes, self-referencing canonicals, and x-default examples.

hreflang tags (<link rel="alternate" hreflang="lang-region" href="https://..." />) are HTML or XML annotations that tell Google which language and regional URL version of a page to display to searchers in different countries. Whether you translate content into multiple languages (en, es, de) or serve regional variants of the same language with local currency and shipping (en-US, en-GB, en-AU), proper hreflang implementation prevents the wrong country's URL from ranking in local SERPs.

You can generate a complete, reciprocal <link rel="alternate" hreflang="..."> cluster in seconds using our free hreflang tag generator.


The 3 Iron Rules of Hreflang Architecture

Most broken hreflang clusters come from violating one of these three rules required by Google's localized versions specification:

1. Bidirectional Reciprocity (Return Links Are Mandatory)

If Page A (en-US) includes a hreflang link pointing to Page B (de-DE), then Page B must include a matching hreflang link pointing back to Page A. If Page B does not link back, Google ignores the annotation to prevent third parties from hijacking rankings for arbitrary foreign pages.

2. Self-Referencing Annotations on Every URL

Every page in a language cluster must include a hreflang tag pointing to itself alongside its siblings. Because every URL in the cluster lists itself plus all alternates, the <link rel="alternate" hreflang="..."> block is 100% identical across every page in that cluster.

3. Self-Referencing Canonical Tags (Never Cross-Canonicalize Locales!)

Each localized URL must have a <link rel="canonical"> tag pointing to its own localized URL (use our canonical URL generator to verify).

  • Correct: https://example.com/uk/pricing has <link rel="canonical" href="https://example.com/uk/pricing" />.
  • Fatal Error: Pointing /uk/pricing or /de/preise canonical tags to /us/pricing tells Google the UK and German pages are duplicates that should be de-indexed.

Copy-and-Paste Reciprocal HTML <head> Example

Suppose your pricing page exists in US English, UK English, German, and Spanish. Place this exact same 5-line block inside the <head> of all four URLs:

<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="de-DE" href="https://www.example.com/de/preise" />
<link rel="alternate" hreflang="es" href="https://www.example.com/es/precios" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/us/pricing" />

Notice how:

  • Both en-US and en-GB use language + region codes to separate USD ($) from GBP (£).
  • es targets all Spanish speakers globally regardless of country.
  • x-default points to the global fallback URL (/us/pricing) for users in countries not explicitly listed (such as Japan or Brazil).

Valid ISO 639-1 (Language) & ISO 3166-1 Alpha-2 (Region) Codes

hreflang values always follow the format language or language-REGION. A region code can never be used by itself without a language prefix:

Target LocaleValid hreflang CodeInvalid Code (Common Mistake)Why the Invalid Version Fails
United Kingdom (English)en-GBen-UKUK is not an assigned ISO 3166-1 Alpha-2 code; Great Britain is GB
European Unionen / fr / deen-EUEU is not a valid country code in hreflang; target languages instead
Latin America (Spanish)es-MX, es-AR, or eses-LA / es-419Google hreflang requires 2-letter ISO 3166-1 Alpha-2 country codes (LA is Laos!)
Traditional vs Simplified Chinesezh-Hant / zh-Hans (or zh-TW / zh-CN)zh-CHSUse ISO 15924 script codes (Hans/Hant) or specific ISO country codes
Global / Language Selectorx-defaultdefaultMust include the x- prefix

Where to Implement Hreflang: HTML <head> vs XML Sitemap vs HTTP Headers

Google supports three equivalent placement methods (choose one to avoid maintenance drift):

Implementation MethodBest ForProsCons
1. HTML <head> TagsSmall-to-medium sites (2–10 locales)Easy to inspect in View Page Source; generated directly by our hreflang tag generatorAdds HTML byte weight if a page has 40+ country versions
2. XML Sitemap (xhtml:link)Large enterprise & e-commerce sites (15+ locales)Keeps HTML <head> lightweight; centralized in sitemap.xmlHarder to debug manually without a crawler
3. HTTP Response HeaderNon-HTML files (PDFs, downloadable docs)Works on binary files that have no HTML <head>Requires server/CDN header configuration

Pre-Launch International SEO QA Checklist

  1. Generate your cluster: Build your <link rel="alternate" hreflang="..."> tags in the free hreflang tag generator.
  2. Verify 200 OK status on every alternate URL: Never point a hreflang attribute to a 301 redirect or 404 page.
  3. Confirm self-referencing canonicals: Check that each locale points its <link rel="canonical"> to itself using the canonical URL generator.
  4. Include all localized URLs in your sitemap: Add every regional URL to your sitemap.xml with the XML sitemap generator and review our XML sitemap best practices guide.
  5. Avoid automatic IP redirects for Googlebot: Because Googlebot crawls primarily from US IP addresses (plus local crawlers), forcibly redirecting all non-UK IPs away from /uk/ prevents Googlebot from ever crawling your UK pages! Use a dismissible country switcher banner instead of forced geo-IP redirects.