Hreflang Tags: The Complete Guide to International SEO

Learn how to implement hreflang tags correctly for international SEO. Covers syntax, implementation methods, language codes, and common mistakes.

Last updated: 2026-02-17

What Hreflang Tags Do

Hreflang tags tell search engines which language and regional version of a page to show to users in different locations. If you have an English page for the US, a Spanish page for Mexico, and a French page for France, hreflang tags connect them so Google serves the right version to the right audience.

Without hreflang tags, search engines guess. They might show your US English page to users searching in French, or your Spanish page might compete with your English page for the same keywords. This leads to duplicate content issues, cannibalized rankings, and a poor user experience for international visitors.

Hreflang is a signal, not a directive. Google uses it as a strong hint, but it can override your hreflang annotations if other signals (like on-page language, user location, or internal linking) contradict them.

Hreflang Syntax Explained

Every hreflang tag follows the same basic structure:

<link rel="alternate" hreflang="language-region" href="https://example.com/page/" />

The hreflang attribute uses ISO 639-1 language codes and optionally ISO 3166-1 alpha-2 region codes.

Hreflang ValueMeaning
enEnglish (any region)
en-USEnglish for United States
en-GBEnglish for United Kingdom
esSpanish (any region)
es-MXSpanish for Mexico
fr-FRFrench for France
fr-CAFrench for Canada
deGerman (any region)
zh-HansSimplified Chinese
x-defaultFallback / language selector page

Key rules for the attribute value:

  • The language code is required. The region code is optional.
  • Language codes are lowercase. Region codes are uppercase.
  • Use a hyphen to separate language and region: en-US, not en_US.
  • You cannot specify a region without a language. hreflang="US" is invalid.
  • The x-default value designates a fallback page for users whose language or region does not match any of your specified versions.

The x-default Tag

The x-default hreflang value is important and often misunderstood. It tells search engines which page to show when none of the other hreflang annotations match the user's language or location.

Typically, you point x-default at one of these:

  • Your language selector or country picker page
  • Your primary English-language version (if it serves as the global default)
  • Your homepage with automatic redirect logic
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" />
<link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/" />

Every page in your hreflang set should include the x-default annotation. If you omit it, search engines pick their own fallback, which may not be what you want.

Three Ways to Implement Hreflang

There are three valid methods for adding hreflang to your site. Each has tradeoffs depending on your tech stack, the number of language versions, and how your site is structured.

Method 1: HTML Head Tags

Place <link> tags in the <head> section of each page. This is the most common method and works well for sites with a manageable number of language versions.

<head>
  <link rel="alternate" hreflang="en-US" href="https://example.com/en-us/pricing/" />
  <link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/pricing/" />
  <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/pricing/" />
  <link rel="alternate" hreflang="x-default" href="https://example.com/pricing/" />
</head>

Every page must reference all alternate versions, including itself. If your English page links to Spanish and French versions, the Spanish page must also link to English, French, and itself.

Best for: Sites with fewer than 10 language/region combinations. Simple to implement and debug.

Downside: Adds HTML bloat to every page. A site with 20 language versions adds 20 <link> tags per page.

Method 2: HTTP Headers

If you serve non-HTML content (PDFs, for example), or if you want to keep your HTML clean, you can use HTTP response headers.

Link: <https://example.com/en-us/doc.pdf>; rel="alternate"; hreflang="en-US",
      <https://example.com/es-mx/doc.pdf>; rel="alternate"; hreflang="es-MX",
      <https://example.com/doc.pdf>; rel="alternate"; hreflang="x-default"

Best for: Non-HTML resources like PDFs, or sites that prefer server-side configuration over in-page markup.

Downside: Harder to manage at scale. Header size limits can be a constraint with many language versions.

Method 3: XML Sitemap

You can declare hreflang relationships directly in your XML sitemap. This is the preferred method for large sites with many language versions because it does not add any weight to individual pages.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/en-us/pricing/</loc>
    <xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/en-us/pricing/" />
    <xhtml:link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/pricing/" />
    <xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/pricing/" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/pricing/" />
  </url>
  <url>
    <loc>https://example.com/es-mx/pricing/</loc>
    <xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/en-us/pricing/" />
    <xhtml:link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/pricing/" />
    <xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/pricing/" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/pricing/" />
  </url>
</urlset>

Best for: Large sites with 10+ language versions, or sites already using sitemaps for indexation management.

Downside: Changes are not visible in the page source, making debugging harder. Sitemap processing by Google can be slower than on-page tags.

You can combine methods, but do not mix methods for the same set of URLs. Pick one method per URL group and stick with it. Conflicting signals from multiple methods can confuse search engines.

Monitor Your Hreflang Implementation

Site Watcher detects broken hreflang tags, missing return links, and language code errors across your entire site. Free for 3 targets.

Language and Region Code Reference

Getting the codes right matters. A single wrong code can invalidate your entire hreflang annotation for that page.

LanguageISO 639-1 CodeCommon Regions
Englishenen-US, en-GB, en-AU, en-CA, en-IN
Spanisheses-ES, es-MX, es-AR, es-CO
Frenchfrfr-FR, fr-CA, fr-BE, fr-CH
Germandede-DE, de-AT, de-CH
Portugueseptpt-BR, pt-PT
Chinesezhzh-CN (simplified), zh-TW (traditional)
Japanesejaja-JP
Koreankoko-KR
Arabicarar-SA, ar-AE, ar-EG
Russianruru-RU

Do not use country codes alone. hreflang="US" is invalid. Do not use three-letter ISO 639-2 codes like eng or fra. Only two-letter ISO 639-1 codes are supported. Do not use uk for Ukrainian (that is the country code for United Kingdom). The correct language code for Ukrainian is uk in ISO 639-1, but always pair it with a region to avoid confusion: uk-UA.

Common Hreflang Mistakes

Even experienced developers make these errors. Each one can undermine your international SEO.

Missing Return Tags

Every hreflang relationship must be bidirectional. If Page A says it has an alternate version at Page B, Page B must also declare Page A as an alternate. Missing return tags are the single most common hreflang error.

Pointing to Non-Canonical URLs

Hreflang URLs must match your canonical URLs exactly. If your canonical URL is https://example.com/pricing/ (with trailing slash), your hreflang must use the same URL. Pointing hreflang at a non-canonical URL (http://, www vs non-www, missing trailing slash) tells Google to ignore the annotation.

Using Wrong Language Codes

Common mistakes include using uk when you mean Ukrainian (it should be uk for the language but people confuse it with United Kingdom), using jp instead of ja for Japanese, or using cn instead of zh for Chinese.

Forgetting x-default

Without x-default, there is no declared fallback for users who do not match any of your specified language/region combinations. Google will pick one on its own, and it may not be the page you want.

Mixing Implementation Methods

Using HTML head tags on some pages and sitemap annotations on others for the same URL set creates conflicting signals. Pick one method per set of URLs.

Self-Referencing Omission

Each page must include a hreflang tag pointing to itself. If your English page only lists the Spanish and French alternates without listing itself, the annotation is incomplete.

Testing Your Hreflang Implementation

Hreflang is easy to get wrong and hard to debug without the right approach.

1

Validate Syntax

Use a hreflang tag checker tool to verify that your language codes, region codes, and URL formats are correct. Look for typos, wrong codes, and protocol mismatches.
2

Check Return Tags

For every page in your hreflang set, confirm that every alternate page also references it back. A single missing return tag breaks the relationship for that pair.
3

Verify Canonical Alignment

Compare your hreflang URLs against your canonical tags. Every hreflang URL must match the canonical URL of the target page exactly.
4

Inspect in Google Search Console

Google Search Console reports hreflang errors under the International Targeting section. Check for "no return tag" errors, "unknown language code" warnings, and other issues.
5

Test with Live Pages

Use Google's URL Inspection tool to see how Google processes your hreflang tags in real time. Check both the rendered HTML and the sitemap to confirm consistency.
6

Set Up Ongoing Monitoring

Hreflang errors creep back in during site migrations, CMS updates, and content publishing. Automated monitoring catches regressions before they affect your international rankings.

Hreflang for Common Site Structures

Different site architectures require different hreflang approaches.

Subdirectory Structure

example.com/en-us/  -> hreflang="en-US"
example.com/es-mx/  -> hreflang="es-MX"
example.com/fr-fr/  -> hreflang="fr-FR"

This is the simplest structure. All versions live under one domain, making hreflang management straightforward. Use HTML head tags or a single sitemap.

Subdomain Structure

us.example.com   -> hreflang="en-US"
mx.example.com   -> hreflang="es-MX"
fr.example.com   -> hreflang="fr-FR"

Each subdomain is treated as a separate site by Google. You need cross-domain hreflang annotations, and each subdomain should have its own sitemap that references all alternates.

Country-Code TLD Structure

example.com    -> hreflang="en-US"
example.com.mx -> hreflang="es-MX"
example.fr     -> hreflang="fr-FR"

This provides the strongest geo-targeting signal but is the most complex to manage. Each domain needs its own Search Console property, and hreflang tags must use fully qualified URLs across domains.

Monitoring Hreflang at Scale

For sites with hundreds or thousands of pages across multiple languages, manual hreflang validation is not feasible. Problems that need automated monitoring include:

Missing Return Tags

When content teams publish a new page in one language but forget to add hreflang annotations in other language versions, the entire chain breaks for that page.

Deleted or Redirected Pages

If a page in your hreflang set gets deleted or redirected, the remaining pages still point to the old URL. This creates broken hreflang references that Google will eventually ignore.

Canonical Drift

CMS updates and migrations can change canonical URLs without updating hreflang tags. Even a small change like adding or removing a trailing slash breaks the relationship.

New Language Launches

When you add a new language version, every existing page in every existing language needs to be updated with the new alternate. Missing even a few pages is common.

Hreflang implementation is straightforward in concept but unforgiving in execution. Every tag must be syntactically correct, bidirectional, and aligned with your canonical URLs, or search engines will ignore it.

Catch Hreflang Errors Before They Hurt Rankings

Site Watcher continuously monitors your hreflang tags, detects missing return links, and alerts you to broken international targeting. $39/mo unlimited, free for 3 targets.