Skip to main content

Hreflang

The hreflang attribute (rel="alternate" hreflang="x") is a technical signal that tells search engines the specific language and geographic targeting of a webpage. When a user queries Google, hreflang ensures the search engine serves the most relevant language or regional version of the page (en-gb vs en-us, or es vs en). Proper hreflang implementation prevents cross-regional duplicate content issues, eliminates keyword cannibalization across country folders, and maximizes global conversion rates by delivering localized experiences.


Learning objectives

After completing this module, you will be able to:

  • Understand the precise syntax and behavioral mechanics of hreflang annotations.
  • Implement error-free hreflang configurations via HTML, HTTP headers, or XML sitemaps.
  • Diagnose and resolve critical hreflang errors, including broken return links and incorrect ISO codes.

Core concepts & syntax rules

1. Language and Region ISO Codes

Hreflang values must follow strict ISO standards:

  • Language: Must use ISO 639-1 two-letter codes (en, es, de, fr, ja).
  • Region (Optional): Must use ISO 3166-1 alpha-2 country codes (US, GB, AU, CA, DE).
  • Syntax: [language]-[region] (e.g., en-US, es-ES, pt-BR).

Critical rule: You can specify a language without a region (es for all Spanish speakers globally), but you cannot specify a region without a language (-US or US alone is invalid).

2. Bidirectional / Reciprocal Return Tags

Hreflang works purely on a reciprocal confirmation system. If Page A (en-US) links to Page B (en-GB) as an alternate, Page B must explicitly link back to Page A. If the return tag is missing on Page B, Google will ignore the hreflang relationship entirely to prevent unauthorized domain spoofing.

3. Self-Referencing Hreflang

Every page inside a localized cluster must include a self-referencing hreflang tag pointing to its own exact URL and language code alongside the tags pointing to its alternates.

4. The x-default Value

The hreflang="x-default" attribute specifies the fallback page to serve to users whose language/country does not match any of your localized alternates (e.g., a searcher from Sweden querying an English/Spanish/German site). Usually, this points to the global English site or a dynamic country/language selector portal.


Three methods of implementation

You should choose one implementation method per website to avoid conflicts and maintenance chaos:

Place <link> tags directly inside the <head> of every localized version:

<link rel="alternate" hreflang="en-US" href="https://example.com/us/shoes/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/shoes/" />
<link rel="alternate" hreflang="es-ES" href="https://example.com/es/shoes/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/us/shoes/" />

Method 2: XML Sitemaps (Best for large enterprise sites & e-commerce)

Keeps page HTML clean by concentrating all hreflang mappings into dedicated XML sitemap files using <xhtml:link> elements:

<url>
<loc>https://example.com/us/shoes/</loc>
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/us/shoes/"/>
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/uk/shoes/"/>
<xhtml:link rel="alternate" hreflang="es-ES" href="https://example.com/es/shoes/"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/us/shoes/"/>
</url>

Method 3: HTTP Headers (Best for non-HTML files like PDFs)

Returned in the server HTTP response header for documents that lack an HTML <head>:

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

Workflow: Deploying and auditing hreflang

Step 1: Map equivalent URL clusters

Create a master database or spreadsheet mapping every exact equivalent URL across your target markets (/us/product-a//uk/product-a//de/produkt-a/). Never link a specific localized product page to a generic category page in another language.

Step 2: Validate ISO codes

Double-check every code against official ISO tables. Ensure common traps are avoided (en-UK is wrong; en-GB is correct for the United Kingdom).

Step 3: Deploy configuration via chosen method

Implement the tags across your CMS templates or generate dynamic multilingual sitemaps. Ensure absolute URLs (https://...) are used throughout.

Step 4: Verify technical prerequisites

Ensure every URL referenced in an hreflang tag:

  • Returns a clean 200 OK HTTP status code (not a 301 redirect or 404 error).
  • Is self-canonicalized (rel="canonical" points to itself, not to a different market URL).
  • Is indexable (no noindex tag, not blocked by robots.txt).

Step 5: Audit and monitor using site crawlers

Run Screaming Frog, Sitebulb, or Ahrefs Site Audit to detect missing return tags, broken target URLs, or non-canonical alternates before submitting to Google.


Checklist

  • All hreflang language codes use valid ISO 639-1 format.
  • All hreflang region codes use valid ISO 3166-1 alpha-2 format (GB, not UK).
  • Every page includes a self-referencing hreflang tag.
  • All alternate connections are 100% reciprocal (bidirectional return tags confirmed).
  • An x-default fallback tag is included across the cluster.
  • Every target hreflang URL returns 200 OK, is indexable, and is self-canonicalized.
  • Absolute URLs (including https:// and trailing slash precision) are used.

Measurement

MetricWhat it tracks
GSC International Targeting / Audit errorsVolume of broken return tags, invalid codes, or conflicting signals
Cross-market SERP alignmentWhether users in target countries see their correct regional URL
Organic CTR across regional marketsImpact of serving localized meta descriptions and currencies in SERPs
Crawl errors on hreflang target URLsDetection of 301s or 404s inside alternate annotations

Common mistakes

Using en-UK instead of en-GB. The United Kingdom's official ISO 3166-1 alpha-2 code is GB. Using UK causes Google to completely invalidate the regional tag, treating it as broken syntax.

Pointing hreflang to pages with 301 redirects or non-canonical URLs. If /us/shoes/ points to /uk/shoes (missing trailing slash which 301 redirects to /uk/shoes/), or to a URL canonicalized elsewhere, search engines drop the hreflang cluster due to conflicting directives.

Missing return tags (One-way hreflang). If your US page points to your German page, but the German page forgets to point back to the US page, the entire connection is ignored.

Combining hreflang and canonicalization incorrectly. Never canonicalize your UK page (/uk/shoes/) to your US page (/us/shoes/) and simultaneously use hreflang (en-gb). If a page has a canonical tag pointing to another market, Google drops it from the index, making the hreflang tag useless. Each localized page must self-canonicalize.