Hreflang is an annotation that tells search engines a page has alternate versions for other languages or regions, so that each user is shown the most appropriate one [1]. It is expressed as rel="alternate" links with an hreflang value made of a language code and an optional region code [1]. International SEO more broadly covers how multilingual and multi-regional sites are structured, signalled and crawled [2].
- Every version must list itself and all other versions; missing return links can cause annotations to be ignored [1].
- Codes are an ISO 639-1 language plus an optional ISO 3166-1 alpha-2 region [1].
- x-default marks the fallback for users who match no listed version [1][5].
- Google determines a page’s language from its visible content, not from lang attributes [2].
1Overview
Sites that serve several languages or regions often have the same content in different versions: a page in English for the UK and the US, and in German for Germany. Hreflang lets the site tell Google that these pages are alternates of one another, so Google can show the right version in each market [1].
Google says hreflang is used to serve the appropriate version; it is not a way to consolidate ranking signals between versions [1][2].
2History
Google announced the rel="alternate" hreflang markup in December 2011 as a way to indicate multilingual and multi-regional versions of content [4]. In April 2013 it added the x-default value for pages that serve no specific locale, such as language selectors [5].
3Language and region codes
The hreflang value starts with a language code in ISO 639-1 format, optionally followed by a hyphen and a region in ISO 3166-1 alpha-2 format [1][7][8]. These conventions follow the wider BCP 47 standard for language tags [6][9].
| Value | Meaning | Valid? |
|---|---|---|
| en | English, any region | Yes [1] |
| en-GB | English, United Kingdom | Yes [1] |
| es-419 | Spanish for Latin America (UN M.49 region) | Supported via BCP 47 [6] |
| en-UK | UK is not an ISO 3166-1 code | No [8] |
| GB | A region cannot be used alone | No [1] |
| x-default | Fallback for unmatched users | Yes [1][5] |
4Three ways to declare
| Method | Where | Best for |
|---|---|---|
| HTML link elements | In each page’s <head> | Most sites [1] |
| HTTP Link header | In the server response | Non-HTML files such as PDFs [1][13] |
| XML sitemap | xhtml:link entries per URL | Large sites with many versions [1][12] |
The three methods are equivalent; Google recommends choosing one and using it consistently [1].
5Rules that make it work
- Self-reference: each version includes itself in its list [1].
- Reciprocity: if page A lists page B, B must list A; otherwise the annotations may be ignored [1].
- Absolute URLs: each href is a fully qualified URL [1].
- Indexable targets: listed URLs should return 200 and be canonical [1][11].
- Self-canonicals: each version should name itself as canonical, not another language [1][11].
6Site structure
Google’s guidance compares four ways to organise international sites: country-code top-level domains, subdomains, subdirectories and URL parameters. Country-code domains give the clearest signal but cost more to run; subdirectories are easiest to maintain; URL parameters are not recommended [2].
Whatever the structure, Google recommends separate URLs for each language version rather than changing content on one URL based on cookies or browser settings [2].
7How Google detects language
Google determines the language of a page from its visible content. It does not rely on code-level indicators such as the HTML lang attribute for this purpose [2], although lang remains important for accessibility and browsers [10].
Mixing languages on one page, such as translated navigation with untranslated body text, makes the language harder to determine [2].
8Locale-adaptive pages and redirects
Some sites change content or redirect users based on their IP address or Accept-Language header. Google warns that Googlebot’s crawlers mostly originate from the United States and usually send no Accept-Language header, so other versions may never be crawled [3][14].
Google recommends letting users choose their version, for example with a language switcher, and using separate URLs with hreflang rather than automatic redirection [2][3].
9Common misconceptions
| Belief | What the sources say |
|---|---|
| Hreflang makes pages rank higher | It selects which version to show [1] |
| The lang attribute sets the language for Google | Google uses visible content [2] |
| One-way hreflang links are enough | Links must be reciprocal [1] |
| IP redirects are the best way to localise | They can hide versions from Googlebot [3] |
See also
- Localization guide: diagrams and quick fixes
- Search indexing: canonicals for each version
- XML sitemaps: declaring hreflang at scale
- Hreflang Checker: validate one page’s cluster
References
- [1]“Tell Google about localized versions of your page”. Google Search Central. developers.google.com/search/docs/specialty/international/localized-versions
- [2]“Managing multi-regional and multilingual sites”. Google Search Central. developers.google.com/search/docs/specialty/international/managing-multi-regional-sites
- [3]“How Google crawls locale-adaptive pages”. Google Search Central. developers.google.com/search/docs/specialty/international/locale-adaptive-pages
- [4]“New markup for multilingual content”. Google Search Central Blog, December 2011. developers.google.com/search/blog/2011/12/new-markup-for-multilingual-content
- [5]“Introducing “x-default hreflang” for international landing pages”. Google Search Central Blog, April 2013. developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
- [6]“RFC 5646: Tags for Identifying Languages (BCP 47)”. IETF, September 2009. www.rfc-editor.org/rfc/rfc5646
- [7]“ISO 639 language codes”. Library of Congress (ISO 639-2 Registration Authority). www.loc.gov/standards/iso639-2/php/code_list.php
- [8]“ISO 3166 country codes”. ISO. www.iso.org/iso-3166-country-codes.html
- [9]“Language tags in HTML and XML”. W3C Internationalization. www.w3.org/International/articles/language-tags/
- [10]“HTML Standard: the lang attribute”. WHATWG. html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes
- [11]“How to specify a canonical URL with rel="canonical" and other methods”. Google Search Central. developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
- [12]“Build and submit a sitemap”. Google Search Central. developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap
- [13]“RFC 8288: Web Linking”. IETF, October 2017. www.rfc-editor.org/rfc/rfc8288
- [14]“Googlebot”. Google Search Central. developers.google.com/search/docs/crawling-indexing/googlebot
- [15]“What is URL canonicalization”. Google Search Central. developers.google.com/search/docs/crawling-indexing/canonicalization