What hreflang is for
If a page exists in more than one language or for more than one region, hreflang tells search engines which version to show to which searcher. Without it, a Spanish searcher may get your English page, or your UK and US pages may compete with each other as duplicates.
Each version lists all the versions, including itself:
<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="x-default" href="https://example.com/" />The rules this checker enforces
- Valid codes. A two-letter ISO 639-1 language code, optionally followed by an ISO 3166-1 region:
en,en-gb,pt-br,es-419. A script subtag likezh-Hantis allowed. Underscores (en_US) anden-ukare the most common mistakes; the UK code isgb. - Self-reference. The page must list itself with its own code.
- One URL per code. The same language code pointing at two URLs is a conflict.
- x-default. Optional but recommended: the fallback for visitors who match none of your languages, often a language picker or the main site.
- Return links. Hreflang must be reciprocal. If page A lists page B, page B must list page A, or Google ignores the pair. We fetch up to 12 alternates to confirm.
- Absolute URLs. Relative hrefs are flagged.
Three places to declare hreflang
In HTML link tags (checked here), in the HTTP Link header (also checked here, and the only option for PDFs), or in the XML sitemap. Use one method consistently. For sitemaps, the sitemap checker is the right tool.
Hreflang works alongside canonicals, not instead of them. Each language version should have a self-referencing canonical; check that with the canonical URL checker.