Hreflang Tag Generator & Validator
Build correct hreflang annotations for multilingual and multi-regional sites. Enter each language/region URL once and get the full reciprocal set as HTML link tags, XML sitemap entries or an HTTP Link header - with x-default, ISO code validation and common mistakes fixed automatically.
Hreflang Generator Workspace
Add one row per language version of the same page. Every version must list all the others, including itself.
| Language | Region | URL | |
|---|---|---|---|
<link rel="alternate" hreflang="en-us" href="https://example.com/" /> <link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" /> <link rel="alternate" hreflang="de" href="https://example.com/de/" /> <link rel="alternate" hreflang="es-mx" href="https://example.com/mx/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
Why International SEOs Use the Agenvix Hreflang Generator
Hreflang fails silently when codes or reciprocity are wrong; the generator prevents both.
Correct Codes Only
Languages are validated against ISO 639-1 and regions against ISO 3166-1 alpha-2. Typical slips like en-uk, en-eu or jp-jp are flagged or corrected.
Reciprocity Built In
The output for each page includes a self-referencing tag and every alternate, so the return-link requirement is always satisfied.
Three Delivery Methods
HTML head tags for normal pages, XML sitemap markup for large sites, and HTTP Link headers for PDFs and other non-HTML files.
Bulk Import
Paste code,URL pairs from a spreadsheet to build clusters of twenty or thirty locales in one go.
Simple as 1-2-3
How the Hreflang Generator Works
One cluster, every page covered.
List the Versions
Add the language, optional region and absolute URL of each translation. Use the same page across rows - hreflang clusters are per page, not per site.
Choose x-default
Pick the URL visitors should see when no language matches, usually the global English page or a language selector.
Copy to Each Page
Paste the HTML block into the head of every version, or use the sitemap output when you have many pages.
Hreflang Delivery Methods Compared
Where to put hreflang annotations depending on site size and file type.
| Feature / Specification | Best Use Case | Engine / Output Standard | Privacy & Security | Performance Rating | Action |
|---|---|---|---|---|---|
| HTML <link> tags | Sites up to a few thousand pages | In <head> of every version | Easiest to audit | Default | |
| XML sitemap | Large or templated sites | xhtml:link per URL | Keeps HTML light | Scalable | |
| HTTP Link header | PDFs, non-HTML files | Link: <url>; rel="alternate"; hreflang | Server configuration | Special | |
| x-default | Fallback for unmatched users | One per cluster | Recommended by Google | Optional |
Hreflang Explained
1. What hreflang does
Hreflang tells Google and Yandex which language and optional region each version of a page targets, so searchers in Mexico see the es-mx page instead of the es-es one. It does not merge ranking signals and it is not a redirect - it is a hint used to swap the displayed URL within a cluster of equivalent pages.
2. Code format: language-REGION
Use an ISO 639-1 language code (en, de, zh) optionally followed by a hyphen and an ISO 3166-1 alpha-2 region (en-gb, de-at, zh-tw). Region-only codes such as "eu" or "uk" are invalid: the United Kingdom is gb and there is no code for Europe. Scripts can be specified for Chinese: zh-Hans and zh-Hant.
3. Reciprocity and self-reference
Every page in the cluster must list every other page and itself. If page A points to B but B does not point back, Google ignores the annotation. Generating the full set from one list and pasting the same block into each version is the simplest way to stay consistent.
4. Common mistakes
Relative URLs, pointing to redirected or noindexed pages, mixing http and https, omitting the self-referencing tag and using the wrong region code account for most failed implementations. The generator requires absolute URLs and validates every code so these never reach production.
Everything you need to know about Hreflang
Codes, placement, x-default and validation.
Do I need a region code?
Only when you target the same language in different countries, such as en-us and en-gb. For a single Spanish version, use es alone so it serves every Spanish speaker.
What is x-default?
The page shown to users whose language or region matches none of the alternates. It is usually the global or language-selector page and can be the same URL as one of the alternates.
Should every page have a self-referencing hreflang?
Yes. Google documents that each version should include a tag pointing to itself as well as to every alternate.
Can I use en-uk?
No. The ISO 3166-1 code for the United Kingdom is GB, so the correct value is en-gb. The generator corrects en-uk automatically.
Where do the tags go?
In the <head> of each HTML page, in your XML sitemap, or in the HTTP Link header for non-HTML files such as PDFs. Use only one method per page to avoid conflicts.
Does hreflang work with canonical tags?
Yes, as long as each alternate page is canonical to itself. Never point hreflang at a URL that canonicalises to a different page.
How many languages can a cluster contain?
There is no official limit. Large sites with dozens of locales typically move the annotations to the XML sitemap to keep page HTML small.
Does Bing use hreflang?
Bing relies mainly on the content-language meta tag and HTTP headers, but hreflang does not hurt. Google and Yandex are the main consumers.
Related Developer Utilities
Discover companion utilities engineered for zero-log speed and browser-side execution.
XML Sitemap Generator
Turn a URL list into valid XML sitemaps with lastmod, auto-splitting and a sitemap index.
Meta Tag Generator
Write title tags and meta descriptions with a live Google SERP preview, pixel limits and Open Graph output.
Robots.txt Tester
Test whether Googlebot, Bingbot or AI crawlers may fetch a URL under your robots.txt rules.
Schema Markup Generator
Create JSON-LD for Article, Product, LocalBusiness, FAQ, Event and more with live validation.
URL Slug Generator
Turn titles into clean, SEO-friendly URL slugs with transliteration, stop-word removal and bulk mode.
Robots.txt Generator
Build a valid robots.txt with per-bot rules, AI crawler blocks, sitemap lines and instant syntax checks.
More in Text & SEO
Specialized utilities within the same technical domain
