Hreflang
What is hreflang?
Hreflang is an annotation, rel="alternate" hreflang="…", that tells search engines which pages are language or regional versions of each other, so they can show searchers the version in their language or for their country. For example, it tells Google to show your en-gb page in the UK and your en-us page in the US.

Each value is a language code in ISO 639-1 format (en, de, fr), optionally followed by a region code in ISO 3166-1 Alpha 2 format (en-gb, en-us, de-at). A region on its own is not valid: you cannot target "gb" without a language. The special value x-default marks the fallback page for users who match none of your versions, often a language selector or your main international page.
You can declare hreflang in three ways, and should pick one: <link> elements in each page’s HTML head, Link HTTP headers (useful for PDFs), or <xhtml:link> entries in your XML sitemap, which is easiest to maintain for big sites.
Two rules trip most sites up. First, annotations must be reciprocal: if page A lists page B as an alternate, page B must list page A. Without the return link, Google may ignore the pair. Second, each page should list every version in its set, including itself.
Hreflang is a signal, not a directive, and it does not merge pages or pass ranking signals between them. Each language version still needs to be indexable and to stand on its own. Google does not use the HTML lang attribute to pick language versions; it relies on hreflang and the content itself.
Why hreflang matters for SEO
Without hreflang, Google may rank the wrong version: your US page in the UK with dollar prices, or the English page for German searchers. Visitors bounce and conversion suffers. Hreflang is the core tool of international SEO.
It also handles near-duplicates. Pages for the UK, US and Australia are often almost identical. Hreflang tells Google they are deliberate regional versions, so it shows the right one rather than picking one and filtering the others.
It is easy to get wrong at scale. Invalid codes such as en-uk (the correct region code is gb), missing return links, alternates pointing at redirects or 404s, and canonicals that point all versions to one URL are the common errors. Any of them can make Google ignore the annotations.
How to implement hreflang
- List every language and regional version of each page and the URL of each one.
- Choose one method: HTML link elements, HTTP headers or the XML sitemap. Mixing methods makes errors more likely.
- On every version, list all versions in the set, including the page itself, with absolute URLs.
- Use valid codes: language first (ISO 639-1), then optionally a region (ISO 3166-1 Alpha 2), such as en-gb, pt-br or es. Don’t invent codes like en-uk or eu.
- Add an
x-defaultentry for the fallback page. - Give each version a self-referencing canonical tag. Don’t point the canonical of the French page at the English one, or Google will drop the French page.
- Make sure every URL in an hreflang set returns 200, is indexable and is not redirected.
- Validate with a crawler that checks return links, and watch the international and indexing reports in Search Console after launch.
Hreflang example
<!-- In the <head> of every version, including this one -->
<link rel="alternate" hreflang="en-gb" href="https://www.example.com/uk/" />
<link rel="alternate" hreflang="en-us" href="https://www.example.com/us/" />
<link rel="alternate" hreflang="de" href="https://www.example.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />
<!-- The same set in an XML sitemap (repeat for each URL) -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.example.com/uk/</loc>
<xhtml:link rel="alternate" hreflang="en-gb" href="https://www.example.com/uk/" />
<xhtml:link rel="alternate" hreflang="en-us" href="https://www.example.com/us/" />
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/" />
</url>
</urlset>Hreflang FAQ
Is hreflang a ranking factor?
No. Hreflang does not make a page rank higher. It helps Google swap in the right language or regional version of a page that already ranks.
Is it en-uk or en-gb?
en-gb. Region codes follow ISO 3166-1 Alpha 2, and the code for the United Kingdom is GB. en-uk is invalid and will be ignored.
What does x-default mean in hreflang?
x-default marks the page to show when none of your language or region versions matches the searcher, such as a language selector or your global homepage.
Do I need hreflang if my site is in one language?
No. Hreflang is only for sites with versions of the same page in different languages or for different regions.
Related SEO terms
International SEO is optimising a site to rank in several countries or languages, using the right URL structure, hreflang and localised content.
The lang attribute declares the language of a page’s content, usually on the <html> element, for browsers, screen readers and translation tools.
A canonical tag is a link element that tells search engines which URL is the main version of a page when duplicates exist.
An XML sitemap is a file that lists the URLs you want search engines to crawl and index, with optional last-modified dates.
Duplicate content is the same or very similar content available at more than one URL, on one site or across sites. Google picks one version to show.
Indexing is when a search engine analyses a crawled page and stores it in its index, so it becomes eligible to appear in search results.