Hreflang Generator
Generate valid HTML hreflang tags, HTTP Link headers, and XML sitemaps with local ISO language/region validation and bidirectional matrix mapping.
Hreflang Configuration
Map language and regional targets with bidirectional validation
Language & Regional Variants (4)
Recommended for language/country selector pages or global default homepages when no other language matches.
Local Validation Diagnostic4 of 4 rows valid
Reciprocal Cluster Matrix
Google requires that every localized page references all other alternate versions, including itself. The matrix below demonstrates the reciprocal relationships generated in this set.
<head> of every listed page to achieve complete bidirectional reciprocity.Output Code
<link rel="alternate" hreflang="en" href="https://your-domain.com/en/" /> <link rel="alternate" hreflang="en-US" href="https://your-domain.com/us/" /> <link rel="alternate" hreflang="en-GB" href="https://your-domain.com/uk/" /> <link rel="alternate" hreflang="es-ES" href="https://your-domain.com/es/" /> <link rel="alternate" hreflang="x-default" href="https://your-domain.com/" />
How to Use the Hreflang Generator
Define Language & Regional Variants
Add ISO language codes (e.g. 'en', 'es') and optional region codes (e.g. 'US', 'GB') alongside their respective destination URLs.
Configure Optional x-default
Enable x-default if you have an international landing page, language selector, or global fallback URL for unmatched visitors.
Inspect Matrix & Copy Code
Review the reciprocal cluster matrix to ensure full coverage, then copy your tags as HTML, HTTP headers, or XML sitemap markup.
What Is Hreflang?
<link rel="alternate" hreflang="..." href="..."> tags, it tells search engines which version of a page to serve based on a searcher's language preferences and location.What Does Hreflang Do?
How to Use the Hreflang Generator
en, es, fr) and optional ISO country code (e.g., US, GB, MX). Input the fully qualified absolute URL for each version.Language Codes and Region Codes
en, de, fr, ja). An optional region component must use a valid ISO 3166-1 Alpha-2 country code (e.g., US, GB, CA, DE).language-REGION (e.g., en-US, en-GB, fr-CA). Google explicitly states that region codes alone are invalid. Specifying hreflang="US" is an error; you must specify hreflang="en-US" or hreflang="es-US".Language-Only vs Language-Region Hreflang
hreflang="es") when one Spanish translation serves all Spanish speakers worldwide (in Spain, Mexico, Argentina, Colombia, etc.) without localized pricing or regulatory differences.hreflang="es-ES" and hreflang="es-MX") when content incorporates market-specific pricing, local currency, shipping policies, or regional idioms. Many websites pair regional tags with a general language-only tag as a fallback for other countries.Reciprocal Hreflang Links
Using x-default
x-default tag (hreflang="x-default") is a special reserved attribute value. It tells search engines which page to serve when a searcher's language or region does not match any of your explicitly targeted variants.x-default is optional, not mandatory. It is ideal for international gateway pages, interactive country selectors, or global default homepages that automatically detect user preferences or prompt visitors to pick their preferred region.Hreflang HTTP Headers
Link HTTP response header.Link: <https://example.com/en/doc.pdf>; rel="alternate"; hreflang="en", <https://example.com/fr/doc.pdf>; rel="alternate"; hreflang="fr". This method requires server-level configuration (e.g., Apache, NGINX, or Cloudflare Workers).Hreflang XML Sitemaps
<url> block listing its own <loc> alongside child <xhtml:link rel="alternate" ... /> tags for all alternate versions, including itself and x-default.Hreflang and Canonical URLs
https://example.com/es/ has its canonical pointing to https://example.com/en/, Google may refuse to index the Spanish version entirely. Each distinct localized page should generally feature a self-referencing canonical tag.Common Hreflang Mistakes
hreflang="UK" instead of hreflang="en-GB".href="/en/" instead of fully qualified https://example.com/en/.200 OK status without intermediate redirects.Hreflang vs HTML lang Attribute
<html lang="fr"> attribute informs web browsers, screen readers, and translation extensions about the primary text language of the current document.<link rel="alternate" hreflang="fr" ...> informs search engine crawlers about the relationship between different URLs in your site architecture. Google uses page content to determine language rather than relying solely on HTML lang attributes.What This Generator Can and Cannot Validate
Frequently Asked Questions
Common questions about hreflang tags, ISO language codes, region targeting, x-default fallbacks, and XML sitemaps.
Was this tool useful?
Your feedback helps us improve VClick Tools.