Definition
Hreflang is an annotation listing the language and regional versions of a page, so a search engine can show each searcher the version that fits. Google accepts it three ways, in HTML link elements, HTTP headers or an XML sitemap, and treats the three as equivalent.
Example. An Australian and a UK version of the same pricing page each carry two lines, hreflang="en-au" and hreflang="en-gb", pointing at both URLs. Remove the lines from either page and Google ignores the pair.
You can check that every alternate links back, and that the page lists itself, with the free Hreflang Tester.
Does Google use hreflang to work out a page's language?
Google does not use hreflang to work out a page's language. Google states that it uses neither hreflang nor the HTML lang attribute to detect language, and relies on its own algorithms instead. Hreflang does a narrower job: it tells Google which URLs are versions of each other, so it can swap in the right one.
Why does hreflang break so often?
Hreflang breaks most often because of missing return links. Google requires each version to list itself and every other version. If two pages do not point to each other, Google ignores the tags between them, while still processing the pages that do link both ways.
The second most common break is the URL format. Alternate URLs must be fully qualified, including the protocol, so https://example.com/foo works and /foo or //example.com/foo do not.
Which language and region codes are valid?
Valid values are an ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha 2 region code. Google supports nothing outside those two lists, and a region on its own is not allowed.
| Value | Valid? | Why |
|---|---|---|
en | Yes | Language only: any English speaker |
en-au | Yes | English, in Australia |
en-gb | Yes | English, in the United Kingdom. Its ISO code is GB |
en-uk | No | UK is not a valid region code. The United Kingdom is GB |
au | No | A region cannot be specified by itself |
x-default | Yes | The fallback when no other version matches the searcher's browser setting |
Does hreflang work when one URL changes language?
Hreflang does not work when one URL serves every language, because the annotation points at URLs, so each version needs its own. A page that changes its language based on the visitor's browser settings, at the same address, gives hreflang nothing to point at.
Sources
- Google Search Central: Tell Google about localized versions of your page
- ISO 639 language codes (Library of Congress registration authority)
- IANA Language Subtag Registry (region codes, including GB)
Last checked against these sources on 19 October 2026.