🤖NEW:AI-Powered Incremental Builds — your site updates in under 30 seconds. See what's new →
← All Tools
100% Free • Hreflang Tag Builder

Hreflang Tag Generator

Build valid HTML hreflang link tags for international multi-language and multi-region websites to target regional search audiences.

Language & Region Pairs (4)

Variant #1
Variant #2
Variant #3
Variant #4

Generated HTML Link Tags

<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" />
<link rel="alternate" hreflang="es-es" href="https://example.com/es/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Technical Deep-Dive

Hreflang Technical Specifications & International SEO

Last updated: August 2026 • Reviewed by Nimbica Technical SEO Team

1. Google Official Hreflang Tag Rules

Hreflang attributes target regional search audiences. As documented in Google Search Central International SEO Hreflang Guide, reciprocal tagging prevents duplicate content issues across regions.

2. Formatting ISO Language & Region Codes

Specify language in ISO 639-1 format (e.g. `en`, `es`) optionally followed by region in ISO 3166-1 Alpha-2 format (e.g. `US`, `GB`).

3. Combining Hreflang with Canonical Meta Tags

Generate HTML meta tags in our Meta Tag Generator.

4. Instant International Routing via Nimbica Edge

Nimbica pre-renders hreflang tags into static HTML served from 300+ global edge locations, ensuring search bots fetch regional directives with sub-50ms TTFB.

5. How to Use This Hreflang Generator

This tool builds the HTML <link rel="alternate"> block used by the most common hreflang implementation method — tags placed directly in the <head> of each page. Follow these steps for a clean, spec-valid output:

  1. For each language or regional variant of a page, add a row: enter its ISO language-region code (e.g. en-us, en-gb, es-es) in the left field and the full absolute URL of that variant in the right field.
  2. Add one x-default row pointing to the fallback page shown to visitors who don't match any listed language or region — typically a language-selector page or your primary international page.
  3. Click Copy Code and paste the entire block into the <head> of every URL listed in the set, not just one page. Every language variant needs the identical set of tags, including a self-referencing entry pointing to itself.
  4. Repeat this generation process for each distinct group of translated pages on your site (e.g. one set per blog post that has been localized).

6. Worked Example: Building a 4-Region Hreflang Set

Consider an online store selling to the US, UK, and Spain, with a default catalog for everyone else. The input pairs are:

  • en-ushttps://example.com/us/
  • en-gbhttps://example.com/uk/
  • es-eshttps://example.com/es/
  • x-defaulthttps://example.com/

The generator outputs:

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

Interpretation: this exact 4-line block must appear on all four pages (/us/, /uk/, /es/, and /) — each page lists itself plus every alternate, satisfying Google's reciprocity requirement. A visitor searching Google from Madrid in Spanish is eligible to be served /es/; a French visitor with no matching entry falls back to the x-default root.

7. Practical Use Cases for Hreflang Tagging

  • International e-commerce: stores running region-specific pricing, currency, and inventory pages (e.g. /us/, /ca/, /eu/) use hreflang to stop Google from treating near-identical product pages as duplicates and to route each country's searchers to the correct checkout currency.
  • SaaS marketing sites: a product with localized landing pages in English, German, and Japanese uses hreflang so example.com/de/ ranks for German queries instead of the English original outranking it in German SERPs.
  • Publishers with country editions: news sites running separate UK and US editions with overlapping stories use hreflang plus en-gb/en-us pairs to serve the geographically relevant edition without duplicate-content cannibalization.
  • SEO agencies migrating multi-region clients: when consolidating ccTLDs (e.g. .co.uk, .de) into subfolders, agencies use bulk hreflang generation to preserve regional targeting signals through the migration.

8. Common Hreflang Mistakes & Edge Cases

  • Missing reciprocal (return) tags: if /us/ links to /uk/ but /uk/ doesn't link back, Google disregards the entire cluster's hreflang annotations as unreliable.
  • Invalid language codes: hreflang requires ISO 639-1 two-letter codes (en, es, de), not three-letter ISO 639-2 codes (eng) and not a region code used alone (us is not a valid language).
  • Wrong code order: the format is always language-REGION (e.g. en-gb), never REGION-language.
  • Pointing hreflang at non-indexable URLs: a hreflang target that returns a noindex tag, a 404, or a redirect is ignored by Google — verify each URL in the Google Indexation Checker before publishing.
  • Conflicting canonical tags: each language variant should have a self-referencing canonical URL, not a canonical pointing to one "master" language version — that would cancel out the hreflang signal entirely.
  • Forgetting the self-referencing entry: every page in a hreflang cluster must include a tag pointing to itself, in addition to its alternates.
  • robots.txt blocking: if an alternate URL is disallowed in robots.txt, Googlebot cannot verify the reciprocal tag and may drop the pairing.

For sites with thousands of localized URLs, hreflang is often better implemented via XML sitemap <xhtml:link> annotations instead of per-page HTML tags, since it centralizes the whole map in one crawlable file. HTTP Link headers are the required method for non-HTML resources like localized PDFs.

Give search engine crawlers sub-50ms response times with Nimbica

Transform dynamic PHP rendering bottlenecks into ultra-fast static HTML deployed across 300+ global edge locations.

Frequently Asked Questions

What are hreflang tags and why are they important for international SEO?

Hreflang tags inform Google search engine crawlers which language and regional version of a page to serve users based on their location and browser language settings.

What is the x-default hreflang attribute value?

The `x-default` hreflang value specifies the fallback landing page for visitors whose language or region is not explicitly matched by other hreflang declarations.

Must hreflang tags be reciprocal across all language pages?

Yes. If page A links to page B via hreflang, page B must also link back to page A with a reciprocal hreflang tag.

What are the three valid ways to implement hreflang tags?

Hreflang can be declared via HTML <link> tags in the page <head>, HTTP Link headers (required for non-HTML files like PDFs), or <xhtml:link> annotations inside an XML sitemap. Only one method should be used per URL set to avoid conflicting signals.

Does hreflang guarantee a page will rank in a specific country?

No. Hreflang is a hint, not a directive. It tells Google which URL is most appropriate for a language/region, but ranking still depends on relevance, content quality, and other standard ranking factors.

Is the hreflang attribute value case-sensitive?

No, hreflang values are case-insensitive per the spec, but Google's own convention is lowercase language codes and uppercase region codes (e.g. en-US) for human readability, even though en-us works identically.

What is the difference between hreflang and the canonical tag?

Canonical tags tell Google which URL is the single authoritative version of duplicate or near-duplicate content. Hreflang tags tell Google that multiple URLs are intentionally different language/region equivalents of each other, none of which should be treated as duplicates.

How do I validate that my hreflang tags are working correctly?

Use the URL Inspection tool in Google Search Console to confirm a page is indexed, view page source to confirm reciprocal tags exist on all variants, and re-run this generator against each variant's live HTML to compare against the expected output.