Hreflang Validator
Check hreflang tags for any URL. Detect missing x-default, invalid language codes, broken bidirectionality and implementation errors.
What is hreflang and when should you use it?
The hreflang attribute is an HTML tag that tells search engines which language or regional version of a page to show each user based on their language settings and geographic location. Introduced by Google in 2011, it is especially important for sites with an international presence. Without hreflang, Google may show the wrong version of your content to users in different countries, reducing CTR and perceived relevance.
Same content, different languages
Your site has a Spanish version and an English version of the same content. Use hreflang so Google shows the right version to each user.
Same language, different regions
You have versions for Spain (es-ES) and Mexico (es-MX) with different local prices or references. Hreflang prevents Google from cannibalizing between them.
Country-adapted content
An online store with country-specific versions (FR, DE, IT) even if the language is the same. Different geographic signals justify the use of hreflang.
The 5 most common hreflang errors
Missing bidirectionality (return tags)
If page A points to page B with hreflang, page B MUST point back to page A. This is the most frequent error and the one Google penalizes by ignoring the entire group. Every URL must include references to all other versions in the group.
URL does not include itself
Each page must include its own URL in the hreflang tag set. That is, the Spanish version must have a hreflang='es' tag pointing to itself, in addition to pointing to all other versions.
Invalid language code
Language codes must follow the ISO 639-1 standard (e.g. 'es', 'en', 'fr'). Region codes must use ISO 3166-1 Alpha 2 (e.g. 'es-ES', 'en-US'). Common mistakes: using 'esp' instead of 'es', or 'ENG' instead of 'en'.
Missing x-default
The x-default tag tells Google which version to show when no other language or region version matches the user. It is not mandatory but strongly recommended. Without it, Google decides on its own which version to show.
Canonical in conflict with hreflang
If page A has a canonical pointing to page B, but also declares a hreflang pointing to A, the canonical takes priority and Google may ignore the hreflang. Each version must have a self-referential canonical (pointing to itself).
How to implement hreflang correctly
Hreflang tags are placed in the <head> of each page. Each language or region version must include the full set of tags, pointing to all other versions including itself.
<!-- In the <head> of each language version --> <link rel="alternate" hreflang="es" href="https://example.com/es/product" /> <link rel="alternate" hreflang="en" href="https://example.com/en/product" /> <link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/product" /> <link rel="alternate" hreflang="x-default" href="https://example.com/en/product" />
Make sure the URLs in hreflang are the final canonical URLs (with or without trailing slash, with or without www — always consistent). An inconsistency in format can break the entire chain.
Can I use hreflang and canonical together?
Yes, and it is actually the recommended setup. The key is that each version has a self-referential canonical (pointing to itself). The error occurs when the canonical points to a different version while hreflang tries to declare the page as a valid alternate.
✓ Correct setup
The es-ES page has a canonical pointing to itself AND hreflang declaring the full group. Google understands it is a legitimate, independent version.
✗ Incorrect setup
The es-ES page has a canonical pointing to en-US (incorrect consolidation). Google will ignore the hreflang because the canonical tells it that es-ES is a duplicate of en-US.