Hreflang Tag Generator
Add a row per language or region variant and get the full reciprocal link block, x-default included, ready to paste into every listed page. Validation runs live and catches underscores, duplicates, and missing pieces.
How to use the output
Hreflang is a set, not a tag. Every URL in the set carries the identical block, listing all
variants including itself, plus the x-default. Paste the generated block into the
<head> of every listed page. If your pages are generated from templates,
wire the block into the template once rather than maintaining it per page. For very large
sites, the XML sitemap format on the second tab is often easier to maintain than per-page
tags, and Google treats both methods the same.
Codes that actually work
The language part uses ISO 639-1 (en, de, fr) and the optional region part uses ISO 3166-1 Alpha 2 (US, GB, DE), joined by a hyphen: en-US, de-DE, pt-BR. A region alone is invalid, "US" by itself means nothing to Google. Underscores (en_US) are the single most common syntax error in the wild, and the validator here flags and fixes them. Script variants like zh-Hans and zh-Hant are valid where one language has multiple writing systems.
Why hreflang sets break
- Missing return links. One page in the set gets updated and the others do not. Regenerate the full block whenever a variant is added or removed.
- Canonicals fighting the set. Every variant needs a self-referencing canonical, never a canonical to another variant.
- Redirected or noindexed variants. Every URL in the set must return 200 and be indexable, or Google drops the annotation for that pair.
Frequently asked questions
Does every page need the full hreflang set?
Yes. Hreflang only works when it is reciprocal: every variant must list every other variant plus itself. If your English page points to the German page but the German page does not point back, Google ignores the annotation. Paste the same complete block on every URL in the set.
How do hreflang and canonical tags interact?
Each language variant must carry a self-referencing canonical. If your German page canonicalizes to the English page, you are telling Google the German URL should not be indexed, which contradicts the hreflang annotation, and Google will drop one of the two signals. Canonical within each variant, hreflang across variants.
What is x-default for?
x-default marks the URL to show users whose language or region matches none of your listed variants. It is typically your language picker, a global homepage, or your primary market version. It is optional but recommended, because without it Google guesses which variant to serve unmatched users.
Does hreflang consolidate rankings across variants?
No. Hreflang does not merge link equity or boost rankings. It is a routing signal: when one of your variants ranks for a query, Google swaps in the variant that matches the searcher's language and region. Each variant still earns its own rankings.