Hreflang tags tell search engines which language or regional URL belongs to each searcher, keeping localized pages from competing against each other. Valid setups require standard ISO codes, reciprocal links across every variant, and a self-referencing canonical on every page.

When Multi-Language and Regional Sites Need Hreflang Tags

If your site serves one language in one country, you do not need hreflang tags. Once you publish localized URLs, Google may still find them on its own. Explicit annotations make sure Search matches each user to the right version.

Per Google's localized versions documentation, alternate markup fits three cases:

Google clarifies two points here. First, different-language pages only count as duplicates when only templates like navigation and footers are translated while the main body stays in the original language. Second, Google does not use `hreflang` or HTML `lang` attributes to detect language; it detects language algorithmically and reads `hreflang` to map relationships.

If you operate separate subdomains or regional hosts, map your domain structure early. Our multi-site and subdomain SEO audit guide explains how to verify crawl boundaries across properties.

Exact Hreflang Syntax, ISO Codes, and x-default Fallback

Each `hreflang` tag maps a language code to a fully qualified URL. In HTML, place `<link>` elements inside `<head>` using full `https://` or `http://` addresses. Relative paths like `/es/guide/` and protocol-relative URLs like `//example.com/es/` fail validation.

Google accepts three standard code parts separated by hyphens:

Two code errors break indie sites often. First, never write `en-UK` for British English. Google states that reserved codes like `UK`, `EU`, and `UN` are ignored in Search; the official ISO 3166-1 Alpha 2 region code for the UK is `GB`, so write `en-GB`.

Second, never list a country code alone or use numeric UN codes like `es-419`. A bare `be` code means Belarusian, not Belgium. Belgian pages should use `nl-BE`, `fr-BE`, or `de-BE`.

When targeting multiple English regions such as `en-IE`, `en-CA`, and `en-AU`, add a catchall `en` URL for other English speakers. Also add `hreflang="x-default"` for a global landing page or language selector when no locale matches.

Format clean pairs and check for duplicate codes with SearchBop's free Hreflang Tag Generator.

HTML Head Tags vs. XML Sitemap Implementation

Google supports three ways to declare alternates: HTML `<head>` tags, HTTP `Link:` headers for files like PDFs, and XML sitemaps. All three perform identically in Search. Pick one method instead of maintaining duplicate tag sets in two places.

HTML `<head>` tags suit smaller static sites with two to five locales. Every variant lists itself and every sibling URL.

```html <link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" /> <link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" /> ```

Give each alternate its own `<link>` element. Google warns against mixing `hreflang` with other attributes like `media` on a single `<link>` tag.

Once you manage dozens of locales or thousands of pages, HTML `<head>` blocks bloat every template. Moving `hreflang` into an XML sitemap keeps page markup light. Add the `xhtml` namespace and repeat every `<xhtml:link>` sibling inside each `<url>` block.

```xml <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url> <loc>https://example.com/en/</loc> <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/" /> <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/" /> </url> </urlset> ```

Every `<url>` entry must repeat the full cluster, including a self-reference. For static builds, check our Cloudflare Pages Markdown blog SEO guide. If new locale URLs sit unindexed, review our sitemap submitted but not indexed guide.

The Canonical and Hreflang Conflict That Drops Pages

The costliest bug in localized builds happens when non-default pages canonicalize back to the English root URL. Developers often reuse one shared layout and forget to update `rel="canonical"` per locale.

That sends Google contradictory signals. Per Google's canonicalization guide, canonicals merge duplicate URLs into one representative address. Pointing `/de/guide/` canonical to `/en/guide/` tells Google to ignore the German page, while `hreflang` asks Google to serve it.

As Google's canonical consolidation docs note, Google prefers URLs inside an established `hreflang` cluster and recommends same-language canonicals. Cross-locale canonicals conflict with `hreflang` and can cause Google to fold the localized page into the canonical URL and drop it from regional results.

Follow two rules across every localized route:

In Next.js App Router, configure `metadataBase` and generate dynamic `alternates` inside `generateMetadata`.

```tsx export async function generateMetadata({ params }) { const { locale, slug } = await params; return { metadataBase: new URL("https://example.com"), alternates: { canonical: `/${locale}/guides/${slug}/`, languages: { en: `/en/guides/${slug}/`, de: `/de/guides/${slug}/` }, }, }; } ```

If localized routes stay out of the index after fixing templates, read our Next.js canonical URL and sitemap guide. You can also verify compiled `<head>` tags locally with SearchBop's HTML SEO Checker.

Seven Hreflang Mistakes and How to Audit Return Links

Google drops broken `hreflang` silently without throwing a manual penalty. Audit your markup regularly for these seven mistakes:

  1. Missing return links. If page A points to page B without a matching return link from B to A, Google ignores both tags.
  2. Missing self-reference. Every localized URL must list itself in its own alternate set.
  3. Cross-locale canonicals. Pointing `/tr/` or `/es/` canonicals to `/` tells Google to drop the translation.
  4. Relative URLs. Paths like `/fr/pricing/` or `//example.com/fr/` violate the fully-qualified URL rule.
  5. Invalid ISO codes. Values like `en-UK`, `es-419`, `eu`, or bare country codes like `be` fail silently.
  6. Broken or blocked targets. Listing 301 redirects, 404 pages, or `noindex` URLs invalidates the link.
  7. Malformed `<head>` tags. Broken markup before `<link>` tags pushes them into `<body>`, where crawlers skip them.

Google deprecated Search Console's legacy International Targeting report, though Google Search still supports `hreflang`. Run this four-step audit before every release instead:

Frequently asked questions

Do hreflang tags require a self-referencing tag on every page?

Yes. Google requires every localized page to include an alternate link pointing to itself alongside all sibling versions. Missing self-references make the cluster incomplete.

Can I point canonical tags on localized pages to the English version?

No. Every indexable localized page needs a self-referencing canonical tag. Pointing translated URLs to an English canonical tells Google to treat them as duplicates and ignore hreflang.

What is the difference between hreflang="en-GB" and hreflang="en-UK"?

Only `en-GB` is valid. Google requires ISO 3166-1 Alpha 2 country codes, where `GB` represents the United Kingdom and `UK` is ignored.

Should I put hreflang tags in HTML or in my XML sitemap?

Google treats HTML tags, XML sitemaps, and HTTP Link headers equally, so pick one method. HTML tags suit smaller sites, while XML sitemaps keep templates cleaner across many locales.

When should you use hreflang="x-default"?

Use `hreflang="x-default"` for a fallback URL when a visitor's browser language matches none of your targeted locales. Google recommends it especially for country selectors and auto-redirecting homepages.

Generate Valid Hreflang Tags and Audit Every Locale

Build clean reciprocal blocks and `x-default` fallbacks in seconds with SearchBop's free Hreflang Tag Generator, then inspect compiled canonicals in the HTML SEO Checker. When you want ongoing technical audits and fix suggestions across all your localized routes, try SearchBop—a desktop SEO and App Store Optimization assistant with free calculators.

Try SearchBop

Sources: Google Search Central — Tell Google about localized versions of your page, Google Search Central — What is URL canonicalization, Google Search Central — How to specify a canonical URL with rel="canonical" and other methods, Google Search Console Help — The International Targeting report is deprecated, Next.js Documentation — Functions: generateMetadata, SearchBop — Hreflang Tag Generator

Hreflang Tags Guide: Syntax, Self-Canonicals & International SEO

Hreflang tags tell search engines which language or regional URL belongs to each searcher, keeping localized pages from competing against each other. Valid setups require standard ISO codes, reciprocal links across every variant, and a self-referencing canonical on every page.

When Multi-Language and Regional Sites Need Hreflang Tags

If your site serves one language in one country, you do not need hreflang tags. Once you publish localized URLs, Google may still find them on its own. Explicit annotations make sure Search matches each user to the right version.

Per Google's localized versions documentation, alternate markup fits three cases:

  • Fully translated pages: You publish complete translations, such as English and German versions of a guide.
  • Single-language regional variants: You serve similar English copy to the US, UK, and Ireland with local currency or shipping terms.
  • Translated templates around shared content: You translate navigation and footers on forums while user posts stay in one language.

Google clarifies two points here. First, different-language pages only count as duplicates when only templates like navigation and footers are translated while the main body stays in the original language. Second, Google does not use `hreflang` or HTML `lang` attributes to detect language; it detects language algorithmically and reads `hreflang` to map relationships.

If you operate separate subdomains or regional hosts, map your domain structure early. Our multi-site and subdomain SEO audit guide explains how to verify crawl boundaries across properties.

Exact Hreflang Syntax, ISO Codes, and x-default Fallback

Each `hreflang` tag maps a language code to a fully qualified URL. In HTML, place `<link>` elements inside `<head>` using full `https://` or `http://` addresses. Relative paths like `/es/guide/` and protocol-relative URLs like `//example.com/es/` fail validation.

Google accepts three standard code parts separated by hyphens:

  • Language code (required): Two-letter ISO 639-1 format, such as `en`, `es`, `de`, or `tr`.
  • Region code (optional): Two-letter ISO 3166-1 Alpha 2 format, such as `en-US`, `en-GB`, or `de-CH`.
  • Script code (optional): ISO 15924 format when writing systems differ, such as `zh-Hans`, `zh-Hant`, or `zh-Hans-US`.

Two code errors break indie sites often. First, never write `en-UK` for British English. Google states that reserved codes like `UK`, `EU`, and `UN` are ignored in Search; the official ISO 3166-1 Alpha 2 region code for the UK is `GB`, so write `en-GB`.

Second, never list a country code alone or use numeric UN codes like `es-419`. A bare `be` code means Belarusian, not Belgium. Belgian pages should use `nl-BE`, `fr-BE`, or `de-BE`.

When targeting multiple English regions such as `en-IE`, `en-CA`, and `en-AU`, add a catchall `en` URL for other English speakers. Also add `hreflang="x-default"` for a global landing page or language selector when no locale matches.

Format clean pairs and check for duplicate codes with SearchBop's free Hreflang Tag Generator.

HTML Head Tags vs. XML Sitemap Implementation

Google supports three ways to declare alternates: HTML `<head>` tags, HTTP `Link:` headers for files like PDFs, and XML sitemaps. All three perform identically in Search. Pick one method instead of maintaining duplicate tag sets in two places.

HTML `<head>` tags suit smaller static sites with two to five locales. Every variant lists itself and every sibling URL.

```html <link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" /> <link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" /> ```

Give each alternate its own `<link>` element. Google warns against mixing `hreflang` with other attributes like `media` on a single `<link>` tag.

Once you manage dozens of locales or thousands of pages, HTML `<head>` blocks bloat every template. Moving `hreflang` into an XML sitemap keeps page markup light. Add the `xhtml` namespace and repeat every `<xhtml:link>` sibling inside each `<url>` block.

```xml <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url> <loc>https://example.com/en/</loc> <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/" /> <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/" /> </url> </urlset> ```

Every `<url>` entry must repeat the full cluster, including a self-reference. For static builds, check our Cloudflare Pages Markdown blog SEO guide. If new locale URLs sit unindexed, review our sitemap submitted but not indexed guide.

The Canonical and Hreflang Conflict That Drops Pages

The costliest bug in localized builds happens when non-default pages canonicalize back to the English root URL. Developers often reuse one shared layout and forget to update `rel="canonical"` per locale.

That sends Google contradictory signals. Per Google's canonicalization guide, canonicals merge duplicate URLs into one representative address. Pointing `/de/guide/` canonical to `/en/guide/` tells Google to ignore the German page, while `hreflang` asks Google to serve it.

As Google's canonical consolidation docs note, Google prefers URLs inside an established `hreflang` cluster and recommends same-language canonicals. Cross-locale canonicals conflict with `hreflang` and can cause Google to fold the localized page into the canonical URL and drop it from regional results.

Follow two rules across every localized route:

  • Use self-referencing canonicals: `/en/guide/` must canonicalize to `/en/guide/`, and `/de/guide/` must canonicalize to `/de/guide/`.
  • Point hreflang only to canonical URLs: Exclude redirecting paths, `noindex` pages, and URLs with tracking parameters.

In Next.js App Router, configure `metadataBase` and generate dynamic `alternates` inside `generateMetadata`.

```tsx export async function generateMetadata({ params }) { const { locale, slug } = await params; return { metadataBase: new URL("https://example.com"), alternates: { canonical: `/${locale}/guides/${slug}/`, languages: { en: `/en/guides/${slug}/`, de: `/de/guides/${slug}/` }, }, }; } ```

If localized routes stay out of the index after fixing templates, read our Next.js canonical URL and sitemap guide. You can also verify compiled `<head>` tags locally with SearchBop's HTML SEO Checker.

Seven Hreflang Mistakes and How to Audit Return Links

Google drops broken `hreflang` silently without throwing a manual penalty. Audit your markup regularly for these seven mistakes:

  1. Missing return links. If page A points to page B without a matching return link from B to A, Google ignores both tags.
  2. Missing self-reference. Every localized URL must list itself in its own alternate set.
  3. Cross-locale canonicals. Pointing `/tr/` or `/es/` canonicals to `/` tells Google to drop the translation.
  4. Relative URLs. Paths like `/fr/pricing/` or `//example.com/fr/` violate the fully-qualified URL rule.
  5. Invalid ISO codes. Values like `en-UK`, `es-419`, `eu`, or bare country codes like `be` fail silently.
  6. Broken or blocked targets. Listing 301 redirects, 404 pages, or `noindex` URLs invalidates the link.
  7. Malformed `<head>` tags. Broken markup before `<link>` tags pushes them into `<body>`, where crawlers skip them.

Google deprecated Search Console's legacy International Targeting report, though Google Search still supports `hreflang`. Run this four-step audit before every release instead:

  • Check rendered `<head>` tags: Confirm every locale prints a self-referencing canonical and complete `https://` alternates.
  • Verify return links: Fetch each alternate URL and check that it links back with the exact same URL and trailing slash.
  • Confirm `200 OK` status: Ensure no target URL redirects or blocks indexing via `robots.txt` or `noindex`.
  • Regenerate clean blocks: Use SearchBop's Hreflang Tag Generator whenever you add a locale so every page ships identical pairs.

Frequently asked questions

Do hreflang tags require a self-referencing tag on every page?

Yes. Google requires every localized page to include an alternate link pointing to itself alongside all sibling versions. Missing self-references make the cluster incomplete.

Can I point canonical tags on localized pages to the English version?

No. Every indexable localized page needs a self-referencing canonical tag. Pointing translated URLs to an English canonical tells Google to treat them as duplicates and ignore hreflang.

What is the difference between hreflang="en-GB" and hreflang="en-UK"?

Only `en-GB` is valid. Google requires ISO 3166-1 Alpha 2 country codes, where `GB` represents the United Kingdom and `UK` is ignored.

Should I put hreflang tags in HTML or in my XML sitemap?

Google treats HTML tags, XML sitemaps, and HTTP Link headers equally, so pick one method. HTML tags suit smaller sites, while XML sitemaps keep templates cleaner across many locales.

When should you use hreflang="x-default"?

Use `hreflang="x-default"` for a fallback URL when a visitor's browser language matches none of your targeted locales. Google recommends it especially for country selectors and auto-redirecting homepages.

Generate Valid Hreflang Tags and Audit Every Locale

Build clean reciprocal blocks and `x-default` fallbacks in seconds with SearchBop's free Hreflang Tag Generator, then inspect compiled canonicals in the HTML SEO Checker. When you want ongoing technical audits and fix suggestions across all your localized routes, try SearchBop—a desktop SEO and App Store Optimization assistant with free calculators.

Try SearchBop

Sources: Google Search Central — Tell Google about localized versions of your page, Google Search Central — What is URL canonicalization, Google Search Central — How to specify a canonical URL with rel="canonical" and other methods, Google Search Console Help — The International Targeting report is deprecated, Next.js Documentation — Functions: generateMetadata, SearchBop — Hreflang Tag Generator

Related workflows

Explore the relevant Searchbop workflow or use a free browser tool.