hreflang: telling Google about localized pages
hreflang annotations tell Google which URLs are language or regional versions of the same page, so Search can send each user to the most suitable version. Google Search Central documents three equivalent ways to declare these versions and a short list of rules they must follow.
Verified against the sources on 2026-11-25. Labels: Proven means the primary source we opened states it. Practice means widely used practice or secondary reporting the primary source does not confirm. Experimental means a proposal or draft.
When does Google suggest declaring localized versions?
- Proven When only the page template, such as navigation and footer, is translated while the main content stays in one language, a pattern the page links to forums.
- Proven When the same language has small regional variations, for example English for the US, Great Britain and Ireland.
- Proven When the site is fully translated into several languages.
- Proven Google may find alternate versions without annotations, but the page says explicit declarations are generally better.
What are the three ways to declare versions?
- Proven HTML:
<link rel="alternate" hreflang="lang_code" href="url_of_page" />elements inside a well-formed<head>; hreflang should not be combined with other attributes such asmediain the same tag. - Proven HTTP headers: a
Linkheader listing each URL in angle brackets withrel="alternate"and an hreflang value, which suits non-HTML files such as PDFs. - Proven Sitemaps: each
<url>entry lists every variant, including itself, as<xhtml:link>children using thehttp://www.w3.org/1999/xhtmlnamespace. - Proven Google treats the three methods as equivalent; using more than one adds maintenance without benefit.
Which rules must every set of annotations follow?
- Proven Each version lists itself as well as every other version.
- Proven Links must be bidirectional: if page X points to page Y, Y must point back to X, or Google may ignore the annotations. The page says this stops other sites claiming your pages as alternates.
- Proven URLs must be fully qualified, including the protocol, such as
https://example.com/foo. - Proven Alternate URLs do not have to be on the same domain.
- Proven The
x-defaultvalue marks the fallback page for users whose language matches none of the listed versions, for example a language selector page.
How are language and region codes written?
- Proven The language comes first as an ISO 639-1 code; an optional region follows as an ISO 3166-1 Alpha 2 code, as in
en-GB. - Proven A script can be given with an ISO 15924 code, such as
zh-Hant. - Proven A region code alone is not valid. The page notes that
bemeans the Belarusian language, not Belgium. - Proven Reserved codes such as
UKorEUhave no effect; the United Kingdom isGB. - Proven Google does not use hreflang or the HTML
langattribute to detect a page’s language; its guide to multi-regional sites says it uses the visible content of the page. - Proven The same guide recommends a separate URL for each language version rather than switching language with cookies or browser settings.
- Proven Localized pages are only treated as duplicates if the main content stays untranslated.
What this page does not cover
- How hreflang is handled by search engines other than Google.
- Choosing a URL structure (subdomains, folders or country domains) for an international site.
- Third-party hreflang validators, which the Google page says it does not maintain or verify.