How to set up hreflang for multilingual sites
hreflang tags tell Google which language and country each version of a page serves. They must be reciprocal and include the page itself.
Step by step, with screenshots: hreflang in sitemaps vs in HTML: pick one and keep it consistent →
Check your own site
Runs these 4 checks and the other 189, free, in about 45 seconds.
Or run only this check with the free Hreflang generator or the free Hreflang checker.
What it is
hreflang is an attribute that tells search engines which language, and optionally which country, each version of a page is written for, so they show the right version to each searcher. It is written as <link rel="alternate" hreflang="de-AT" href="…"> in the head, in an HTTP header or in the XML sitemap.
It only works as a complete set: every version must list every other version and itself, with valid ISO language codes and optional region codes, and every listed URL must answer 200. When one link back is missing, Google ignores that pair and visitors may land on the wrong language.
OK looks like this: each language version carries the same full list of alternates, including itself, at most one x-default, and each version's canonical points to itself. getReport checks the codes, the return links and whether each alternate loads.
What a passing site looks like
- Every language version your pages list links back to themwarning · −2 ptseffort M
- Every hreflang alternate links back to this pagewarning · −1.5 ptseffort M
- hreflang tags are complete and validwarning · −1.5 ptseffort M
- Every hreflang alternate returns HTTP 200warning · −1 ptseffort S
1. hreflang return links across the site
Why it matters. hreflang tags tell Google which language or country version of a page to show. Google only trusts a pair when both pages name each other; a one-way tag is ignored, so searchers may land on the wrong language.
- On each language version listed, add an hreflang tag that points back to the page that names it, and one for itself.
- Generate the tags from one list of translations so every version lists the same set.
- In WordPress, a translation plugin such as WPML or Polylang adds the full set once the translations are linked to each other.
2. hreflang return links
Why it matters. hreflang only works when every version lists every other version, including itself. An alternate that does not point back makes Google ignore the pair, so visitors get the wrong language.
- On each alternate page, add a <link rel="alternate" hreflang="…"> for this page and for itself.
- Generate the tags from one list (CMS, plugin or the XML sitemap with xhtml:link) so every page carries the same set.
3. hreflang tags are incomplete or invalid
Why it matters. hreflang tells Google which language or country version to show each searcher. A missing self-reference or an invalid code makes the whole set ignored, so visitors land on the wrong version.
- Use valid codes (language, optionally a region; for example "en", "en-GB", "de-AT") and at most one "x-default".
- Include this page's own URL in its hreflang set, and list the same set on every version.
4. hreflang alternates status
Why it matters. An alternate that answers 404 or redirects is dropped from the hreflang set, and the whole set can be ignored. Old language versions are often removed without updating the tags.
- Point each hreflang entry at a live URL that answers 200 directly (no redirect).
- Remove entries for language versions you no longer publish.
Questions people ask
Where should hreflang go, in the HTML, an HTTP header or the sitemap?
Any one of the three works, and Google treats them the same. Link tags in the head suit most sites; the HTTP header is for PDFs and other files without HTML; the XML sitemap suits large sites, because it keeps every set in one file. Pick one method, since two that disagree make the result unpredictable.
Should hreflang URLs match the canonical?
Yes. Each language version should have a canonical tag pointing to itself, and hreflang should list those same canonical URLs. If a French page canonicalises to the English page, Google treats it as a duplicate and ignores its hreflang. Never point all language versions' canonicals at one version.
What is hreflang x-default?
x-default is a special hreflang value for the page to show when no listed language or region matches the searcher, often a language picker or the international English version. It is optional, you use it at most once per set, and it must appear on every page in the set like the other alternates.
What are hreflang return tags?
Return tags are the links back: if page A lists page B as an alternate, page B must list page A too. Google only trusts a pair when both sides confirm it, so a missing return tag makes it ignore the pair. Generating all tags from one list in your CMS or sitemap keeps them in sync.