HREFLANGRight language, right pageIf your site has a German version, or separate pages for UK and US buyers, Google needs to know those pages are versions of each other. Without that, a searcher in Munich may land on the English page, or your UK and US pages may be treated as duplicates and only one shown. Hreflang annotations solve this. The mistakes that break them are few and well documented, so they are easy to avoid.
What does hreflang do?
Hreflang tells Google that a set of pages are localised versions of the same content, so Search can point each user to the most suitable version for their language or region. Google matches results to the user's browser settings. It doesn't use hreflang, or the HTML lang attribute, to work out what language a page is in; its algorithms do that.
Google recommends hreflang in three situations: you translate only the template, such as navigation and footer; you have small regional variations of the same content in one language, like English pages for the US, the UK and Ireland; or the site is fully translated.
How do you add hreflang to a page?
Choose one of three methods: link elements in the HTML <head>, an HTTP Link header, or entries in your XML sitemap. Google treats them as equivalent, and using more than one brings no benefit in Search, only more to maintain. For a site with UK, US and German versions, the HTML method looks like this, and the identical block goes on every version:
<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 HTTP header method suits PDFs and other non-HTML files. The sitemap method keeps the annotations out of page templates, and Google doesn't count the alternate entries towards the sitemap URL limit.
Why do hreflang tags get ignored?
Most often because return links are missing. If page X points to page Y, page Y must point back to page X, and when two pages don't both point to each other, Google ignores the tags. The rule stops another site from declaring itself an alternate version of your page. Check every set against this list:
- Each version lists itself as well as every other version.
- URLs are fully qualified, including
https://. Google doesn't accept/de/or//example.com/de/. - The tags sit inside a well-formed
<head>. If in doubt, Google suggests running the rendered page through an HTML validator. - Hreflang isn't combined with other attributes, such as
media, in the same link tag. - Each version's canonical tag points to a page in the same language, not back to the English original.
Which language and region codes are valid?
The language comes first, in ISO 639-1 format, optionally followed by a region in ISO 3166-1 Alpha 2. So de means German content for any region, en-GB means English for users in the UK, and de-ES means German for users in Spain. Google accepts any letter case, though uppercase regions follow the ISO convention. These are the codes that trip people up:
en-UK:UKisn't the code to use for the United Kingdom, and Google ignores that part of the annotation. Useen-GB.es-419for Latin American Spanish: not supported, because it sits outside those two standards.- A country on its own, such as
befor Belgium: the first code is always the language, andbeis Belarusian. Usenl-BE,fr-BEorde-BE. EUorUNas a region: no effect on Google Search.
When should you use x-default?
Use x-default for the page that should catch everyone whose language settings match none of your versions. Google designed it for language and country selector pages, where it works best, though it can point to any page, such as your main English home page. It needs no language code of its own.
If you have several versions in one language, say for Ireland, Canada and Australia, Google also suggests a generic en page as a catch-all for English speakers elsewhere. That can be one of the specific pages.
Where to start
Pick one important page and open each of its language versions. Check that every version carries the same complete set of annotations, including itself and x-default, that every code follows the rules above, and that each canonical stays in its own language. If your versions are spread across domains or platforms, our SEO and AI search service can audit and fix the whole set, or you can book a call.
FAQ
Frequently asked questions
Do our language versions have to be on the same domain?
No. Google says alternate URLs don't need to be on the same domain, so a .de site and a .com site can annotate each other. Google also doesn't use subdomain or folder names such as en-gb to work out the audience, so the mapping has to be explicit in your hreflang annotations.
Is a translated page duplicate content?
Not when the main content is translated. Google only treats localised versions as duplicates if the main content stays untranslated. Same-language regional pages are the harder case: when US and UK pages are nearly identical, hreflang helps the right one surface for searchers in each region.
What if we can't keep return links on every page?
Google still processes the pairs that do point to each other, so you can leave some languages out on some pages. When you open a new market, prioritise linking its pages both ways with your original, strongest language version rather than only with each other.
Should we redirect visitors to their language automatically?
Google advises against automatic redirects based on a visitor's perceived language, because they can stop people and search engines from seeing every version. Googlebot usually crawls from the US and doesn't send an Accept-Language header. Give each language its own URL and add visible links so visitors can switch.
How do we test our hreflang setup?
Google points to third-party testing tools, which it says it doesn't maintain or check. We also check by hand: view the source of each version and confirm the full set of annotations is identical on every one, as Google's documentation expects, and that every URL in the set is fully qualified.
Do we need hreflang on a single-language site?
No. Hreflang only describes alternate language or regional versions of a page, so a site with one version of each page has nothing to annotate. Its duplicate URLs, such as pages with tracking parameters, are a job for canonical tags instead.
