Hreflang (language and region annotations)
Hreflang is an annotation that lists all language and region versions of a page so Google can show users the one that matches their settings. It can be placed in the HTML head, in an HTTP Link header or in the XML sitemap; the three are equivalent. Every version must list itself and every other version, or the annotations are ignored.
How it looks
In the HTML head, one <link> per version, the same set on every version:
<link rel="alternate" hreflang="en-GB" href="https://en-gb.example.com/page.html" />
<link rel="alternate" hreflang="en" href="https://en.example.com/page.html" />
<link rel="alternate" hreflang="de" href="https://de.example.com/page.html" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />
As an HTTP header, which is the only option for non-HTML files such as PDFs:
Link: <https://example.com/file.pdf>; rel="alternate"; hreflang="en", <https://de.example.com/file.pdf>; rel="alternate"; hreflang="de"
In an XML sitemap, each <url> gets child <xhtml:link> entries listing every variant including itself, with the xhtml namespace declared on <urlset>:
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.de/deutsch/page.html"/>
Google's documentation on localized versions shows all three in full and states that they are equivalent; using more than one brings no benefit.
How Google handles it
Per the same localized versions documentation, Google uses hreflang to understand that pages are localized variations of the same content and to point users to the most appropriate version by language or region. Google does not use hreflang or the HTML lang attribute to detect the language of a page; that is done by its own algorithms. Localized pages count as duplicates only when the main content is left untranslated.
The rules that apply to every method:
- Each language version must list itself and all other versions.
- URLs must be fully qualified, including the protocol.
- URLs may live on different domains.
- If two pages do not both point to each other, the tags are ignored.
- When a full set is impractical, Google still processes the pairs that point to each other; link new language pages to the original language first.
Hreflang also feeds canonicalization. Google's guide on specifying a canonical says it prefers URLs that are part of an hreflang cluster as canonicals, and that a canonical should be in the same language as the page. How Google chooses between duplicates is explained in the entry on the canonical tag.
Language and region codes
The value is a language code, optionally followed by a dash and a region code: en, en-GB, de-CH. Google's localized versions documentation requires ISO 639-1 for the language and ISO 3166-1 Alpha 2 for the region; codes outside those lists, such as es-419, are not supported. The value is case-insensitive. A region alone is invalid because Google does not derive the language from a country. A script can be stated with ISO 15924, as in zh-Hant.
x-default is the reserved value for users whose settings match none of the listed versions. Google recommends it for language selectors and auto-redirecting home pages; it does not take a language code.
When it matters
- The same language for several markets: English for the US, UK and Ireland with different prices or shipping notes.
- A fully translated site where each language should rank in its own country.
- A migration that changes URLs: every alternate set must be rewritten, which is why hreflang is on the migration checklist.
Small sites with one language and one market do not need it.
Common mistakes
Google's documentation lists the most frequent errors; the table adds their effect.
| Mistake | Effect |
|---|---|
| Missing return links (X lists Y, Y does not list X) | Annotations may be ignored or misread |
Region code without language (hreflang="GB") | Invalid; the annotation is not used |
Reserved or unofficial region codes (EU, UK, UN) | Google ignores that part of the annotation |
| Relative or protocol-less URLs | Not fully qualified; annotation not usable |
| Page does not list itself | The set is incomplete on that version |
| Hreflang pointing at a URL that redirects or is noindex | The target is not an indexable alternate |
| HTTP version of a page in the hreflang set | Pushes Google toward an HTTP canonical |
How to check it
View the page source and search for hreflang=. Every version should appear, including the one you are on, plus x-default if you use it; then open each listed URL and confirm it carries the identical set. With curl:
curl -s https://example.com/page/ | grep -i hreflang
curl -sI https://example.com/file.pdf | grep -i "link:"
For sitemap-based hreflang, fetch the sitemap and check that the xhtml namespace is declared and that every <url> has its <xhtml:link> children; the sitemap checker reads the file and reports status, URL count and a live test of sample URLs. The basics of the file are in the entry on the XML sitemap.
In Search Console, a wrong canonical caused by missing hreflang shows up as Duplicate, Google chose different canonical than user; Google's canonicalization troubleshooting guide names language variants without localized annotations as a common cause.
Why monitor it
IndexRise does not monitor hreflang annotations yet. The closest checks cover what hreflang depends on: each alternate URL must return 200, stay indexable and keep its self-referencing canonical, and all of that is compared with the baseline every night. A language version that starts redirecting, picks up noindex or changes canonical is reported the next morning. The indexability checker is the quickest way to run the same checks on up to 10 alternates by hand.
Frequently asked questions
Is hreflang required for a multilingual site?
No. Google may find alternate language versions on its own, but its documentation says it is usually best to indicate them explicitly, especially when the template is translated and the main content is not, or when regional variants share a language.
What does x-default do?
It names the page for users whose language or region does not match any listed version, typically a language selector or the global home page. Google recommends it as a fallback and it needs no language code.
Can I use only a country code, like hreflang="uk"?
No. The first part must be an ISO 639-1 language code; the region is optional and comes second. Google also ignores reserved codes such as EU or UK, so British English is en-GB.
Do hreflang links have to be on the same domain?
No. Alternate URLs do not need to share a domain, but they must be fully qualified with the protocol, for example https://de.example.com/page.html.
How does hreflang interact with canonical?
Each language version should be its own canonical. Google's canonical documentation says to specify a canonical in the same language and notes that URLs inside an hreflang cluster are preferred as canonicals.
Which method is best: HTML, header or sitemap?
Google says the three are equivalent and advises picking one. HTML is simplest for small sites, the sitemap scales better for large ones, and the HTTP header is the only option for PDFs.
Updated: 2026-10-20