Hreflang
What Hreflang Does
Hreflang is an annotation that tells search engines which version of a page is meant for which language and region. It is used when a site has several versions of similar content, such as an English page for the United States, an English page for the United Kingdom and a German page for Germany. The annotation helps the search engine send each user to the matching version.
In the most common form, the annotation is a link element in the head of the page. It names the language and region in an hreflang value, such as <link rel="alternate" hreflang="en-gb">, and points to the address of that version.
Language Codes, Return Tags and x-default
The value combines an ISO 639-1 language code, such as en or de, with an optional ISO 3166-1 region code, such as gb or de. The region code is a country code, so the United Kingdom is en-gb, not en-uk.
Every version must list all the other versions, and each must link back. These are called return tags. If page A points to page B, page B must point to page A, or the search engine may ignore the annotations. Each page should also list itself.
The value x-default names a fallback page for users whose language or region matches none of the listed versions, such as a general international page with a language selector.
The same information can also be supplied in HTTP headers or an XML sitemap, which suits files such as PDFs that have no head section.
Common Mistakes and What They Cause
Hreflang is easy to get slightly wrong, and a small error can cause the whole set to be ignored:
- Invalid codes, such as a region code that does not exist, for example
en-ukinstead ofen-gb. - Missing return tags, where one version does not link back to the others.
- Pointing to URLs that redirect, return errors or are not the preferred version of the page defined by canonical tags.
- Conflicts with canonical tags, where a page declares a canonical URL that differs from the one in its hreflang set.
Hreflang does not translate content or fix duplicate content. Each version still needs genuinely localized content, because tags pointing to near-identical copies add little value.
One Store, Three Market Versions
An online store sells the same range in the United States, the United Kingdom and Germany, with one page per market. The US page declares its version as en-us, the UK page as en-gb and the German page as de-de. Each page lists all three, and the US page also serves as x-default for visitors from elsewhere.
The pages differ in currency, shipping details and local wording, so each is a real local version rather than a copy. Whether these versions sit in folders or on subdomains is a separate decision, covered in subdomain vs subdirectory.
Frequently asked questions
Does hreflang improve rankings?
Hreflang does not raise rankings in general. It helps search engines show the correct version of a page to users in each language or region, which improves the experience and prevents the wrong version from appearing. Its effect is on which URL is shown, not on how strongly a page ranks.
Do I need hreflang for a single-language site?
Usually not. A site with one language and one audience has no alternate versions to choose between. Sites that target the same language for different regions, such as English for the US and the UK, may still benefit. Hosting location is a separate signal, explained in the server location article.