What Is Hreflang?
Hreflang is an attribute that tells search engines which language and regional version of a page to serve to which users. Written as rel=“alternate” hreflang=“language-region”, it maps each localized URL to an ISO language code and an optional country code, and can be declared in HTML link tags, an HTTP header, or an XML sitemap.
- Hreflang values combine an ISO 639-1 language code with an optional ISO 3166-1 Alpha 2 region code — for example
en,en-GB, orde-CH. - It can be declared three equivalent ways:
<link>tags in the page<head>, an HTTPLinkheader, orxhtml:linkentries inside an XML sitemap. - Annotations must be bidirectional: if page A points to page B but B does not point back, Google ignores the tags.
- The reserved value
x-defaultdesignates a fallback page for users whose language or region matches none of the listed versions.
How Hreflang Works
When a site publishes the same content in several languages or for several countries, search engines face a choice: which URL should a given searcher see? Hreflang is the annotation that answers that question. Each localized page declares the full set of alternate versions and labels each one with a language, and optionally a region, so the search engine can match a user’s language and location to the right URL. Google treats hreflang as a signal to serve the appropriate version, not as an instruction to rank one version over another.
The label is built from standardized codes. The language comes first, using an ISO 639-1 code such as en, de, or pt. An optional region follows after a hyphen, using an ISO 3166-1 Alpha 2 country code such as GB, US, or BR — giving values like en-GB or pt-BR. You can target a language alone (fr for all French speakers) or a language plus region (fr-CA for French speakers in Canada). Region without language is invalid, and there is no code for supranational areas like the EU.
Two rules make or break the setup. First, the annotations must be bidirectional: every version in the cluster must list every other version, and itself. Google’s documentation states plainly that if two pages do not both point to each other, the tags are ignored — with no visible error. Second, the reserved value x-default designates a catch-all page for users whose language and region match none of the listed alternatives, typically a language selector or a global homepage.
Hreflang Syntax and Methods
Google accepts hreflang through three equivalent mechanisms; you pick one per page and stay consistent:
- HTML link tags —
<link rel="alternate" hreflang="…" href="…">elements placed in the page<head>. The most common method, but it adds weight to every page when clusters are large. - HTTP
Linkheader — the same information returned as a response header, useful for non-HTML files such as PDFs where there is no<head>to edit. - XML sitemap —
xhtml:linkchild elements inside each<url>entry, which keeps the annotations out of the page source and centralizes them, an advantage on very large sites.
Whichever method you choose, the reciprocity and code-format rules are identical. Mixing methods for the same page, or annotating with mismatched URL sets across versions, is a frequent source of silent failure.
Example of Hreflang
Google’s official documentation gives the canonical worked example, using example.com variants. A page available in generic English, German, British English, and a global fallback declares, in the <head> of every version:
<link rel="alternate" hreflang="en" href="https://en.example.com/page" />
<link rel="alternate" hreflang="de" href="https://de.example.com/seite" />
<link rel="alternate" hreflang="en-gb" href="https://en-gb.example.com/page" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />
The instructive detail is that this identical block appears on every page in the cluster — the German page carries the same four lines, not a trimmed set — because that is how the required return links are satisfied. A German-in-Germany user is served the de URL, a searcher in the United Kingdom gets en-gb, a generic English speaker gets en, and anyone who fits none of those lands on the x-default. If the German page omitted the line pointing back to the English page, Google would disregard that pairing entirely. The example is deliberately mundane precisely because hreflang rewards discipline over cleverness: correct codes, complete reciprocal sets, and a sensible x-default are the whole game.
Nearly every broken hreflang setup I audit fails on the same thing: return links. People treat hreflang like a one-way instruction — "this page also exists in French over there" — and forget that the French page has to name every other version too, including itself. If the links don’t both point at each other, Google throws the whole cluster out silently; there is no error banner, the tags just stop working. The second-most-common failure is invented region codes. It is not "en-UK" and there is no "EU" region — the language part follows ISO 639-1, the region part follows ISO 3166-1 Alpha 2, so British English is en-GB. And remember what hreflang is not: it is a serving hint, not a canonical. It swaps in the right localized URL for the right user; it does not consolidate duplicate pages or hand one version another’s ranking strength.
Frequently Asked Questions
What is hreflang used for?
What is the correct hreflang format?
en, en-GB, pt-BR. Region codes alone are invalid; language must always come first. Made-up codes like en-UK or EU are not recognized.Do hreflang tags need to be reciprocal?
Does hreflang improve rankings?
The Bottom Line
Hreflang is how a multilingual or multiregional site tells search engines which URL belongs to which audience. Declare it in link tags, an HTTP header, or a sitemap; build values from a language code plus an optional country code; make every version point back at every other, including itself; and set an x-default for everyone who fits none of them. Done right it serves the correct page to the correct user — it does not, on its own, raise rankings.
Sources
- Tell Google about localized versions of your page — Google Search Central
Roborank crawls your site for broken, one-way, and malformed hreflang annotations — and flags the missing return links that quietly switch the whole cluster off.
Audit your hreflang →Rank & Cash — the weekly SEO breakdown
One practical teardown a week on ranking in search and getting cited by AI. No fluff.
