What hreflang says, and how it differs from a canonical
The hreflang tag generator builds rel="alternate" annotations that tell Google a page has equivalents for other languages or regions, so it can show each searcher the matching version. It runs in your browser and fetches nothing.
hreflang and rel=canonical make different claims. A canonical says a set of URLs are duplicates and one should represent them. hreflang says a set of URLs are alternates for different audiences and each should be available. Point a French page's canonical at the English page and the two annotations contradict each other. That is why every page in an hreflang set should carry a canonical that references itself, and why Google asks for a canonical in the same language when hreflang is in use.
hreflang also does not raise rankings. Gary Illyes of Google has said it brings "more targeted traffic," not a ranking benefit, and that signals are not shared between the pages in a cluster.
How the language and region codes are validated
Each value is a language code from ISO 639-1, optionally followed by a region code from ISO 3166-1 Alpha 2: de, de-AT, de-CH. The generator checks entries against both lists. The rules it enforces are the ones people most often get wrong:
- en-UK is flagged. The United Kingdom's ISO code is
GB. Google says reserved codes such asUK,EUandUNhave no effect, and it ignores that part of the annotation. - A region cannot stand alone. Google states that you cannot specify the country code by itself.
- Language comes first, and some codes mislead.
beis Belarusian, not Belgium; Belgian French isfr-BE. - Hyphens, not underscores.
en_USis not the documented format.
Script variants use a third standard, ISO 15924, as in zh-Hant and zh-Hans. Check any script-coded value against Google's documentation rather than relying on the language and region lists alone.
Two values do structural work. A language-only code alongside regional ones, such as es next to es-MX and es-ES, catches Spanish speakers in markets you have not listed. x-default names the page for anyone whose settings match no listed value, often a language selector.
Choosing the HTML link set or the sitemap block
The generator produces both forms. Google calls the methods equivalent and says using several at once brings no benefit in Search, so choose one and maintain it.
- HTML links go in each page's head, which Google requires to be well-formed. They suit sites whose templates can print a different set per page.
- The sitemap block suits large sites and pages whose templates are hard to change. The sitemap must declare the
xhtmlnamespace, and each<url>entry lists every alternate, including itself.
A third method, the HTTP Link header, exists for non-HTML files such as PDFs.
<link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/">
<link rel="alternate" hreflang="de-DE" href="https://www.example.com/de/">
<link rel="alternate" hreflang="x-default" href="https://www.example.com/">The reciprocity check the generator cannot run
Google's localized versions documentation requires each version to list itself and every other version, and warns that if two pages do not point at each other, the annotations are ignored. The rule exists so another site cannot declare itself an alternate of your page.
A generator can build a complete set; it cannot see whether every page carries it. That is the most common way hreflang fails in practice: one locale ships a template without the block, or the list is updated on some pages and not others. Place the identical full set on every page in the cluster.
Exact URL matching is part of reciprocity. If the hreflang value says /de and the German page is served and canonicalized at /de/, or one uses http and the other https, the references do not line up. Google also requires fully qualified URLs. Pointing hreflang only at canonical, indexable URLs that return 200 is widely recommended by crawler vendors, though Google's documentation does not state it as a rule.
Same-language regional pages
Pages such as fr-FR and fr-BE that differ only in a few details can look like duplicates. Google's guidance for regional variants in one language is to use both canonicalization and hreflang, and John Mueller has said it is common for one such page to be selected as canonical, with hreflang often still swapping in the right URL while Search Console reports on the canonical. If each market needs its own indexed page, give it genuinely different content such as currency, pricing or terms.
For Bing, a December 2025 Bing Webmaster blog post recommends hreflang for language and regional targeting. Adding a content-language meta tag and the html lang attribute is a common precaution. Google ignores both for language detection.
Checking hreflang after it ships
Search Console no longer has an hreflang error report; the International Targeting report was retired in 2022. Checking now means combining sources: URL Inspection for the Google-selected canonical of each locale, the Performance report filtered by country and page to see whether the expected URL is shown in each market, and a site crawler to test return links and codes at scale. Avoid redirecting visitors automatically by IP or browser language; Google advises against it.
Frequently asked questions
Is en-UK a valid hreflang code?
No. The United Kingdom's ISO 3166-1 code is GB, so the correct value is en-GB. Google says reserved codes such as UK, EU and UN have no effect, and it ignores that part of the annotation.
Does every page need to list itself in hreflang?
Yes. Google's documentation says each version must list itself as well as all other versions. In a sitemap, each URL entry likewise lists every alternate including itself.
Do I need x-default?
It is optional but useful. x-default names the page for users whose language and region settings match none of your listed values, often a language selector or a global home page. Without it, no page is designated for them.
Should hreflang pages canonicalize to the main language version?
No. Each language version should carry a self-referencing canonical. A canonical pointing across languages tells Google the pages are duplicates, which contradicts hreflang's claim that they serve different audiences.
Can the hreflang generator check my live pages for return links?
No. It runs in your browser and builds the markup without fetching anything. Confirming that every page carries the full reciprocal set takes a site crawler or a manual check of each page's head or sitemap entry.