
How does hreflang work?
Hreflang works by listing every language or country version of a page, including the page itself, in a set of alternate links. When Google finds the same content in Polish, German and English, the annotations help it swap in the right URL for a searcher in Warsaw, Berlin or London. Hreflang does not boost rankings; it decides which of your own URLs appears in each market.
A basic set for one page looks like this in the head:
- <link rel=”alternate” hreflang=”pl-PL” href=”https://example.com/pl/” />
- <link rel=”alternate” hreflang=”de-DE” href=”https://example.com/de/” />
- <link rel=”alternate” hreflang=”x-default” href=”https://example.com/” />
Hreflang syntax: language, region and x-default
The hreflang value is a language code in ISO 639-1 format, optionally followed by a region code in ISO 3166-1 Alpha 2 format. The layers below summarise the rules from Google Search Central.
Language code
The language code comes first and is required: pl, de, en. A region code alone, such as PL, is invalid.
Region code
The optional region narrows the target: en-GB for the United Kingdom, de-AT for Austria. Use GB, never UK, because Google ignores UK, EU and UN.
x-default
The reserved x-default value names the fallback page for users whose browser language matches none of your versions. It fits a language selector or a global English homepage.
3 ways to implement hreflang
Google treats HTML link tags, HTTP headers and XML sitemaps as equivalent, so pick one method per site:
| Method | Where | Best for |
|---|---|---|
| HTML link tags | In the page head | Small and mid-size sites |
| HTTP Link header | Server response | PDFs and other non-HTML files |
| XML sitemap | xhtml:link entries | Large e-commerce sites with many versions |
Hreflang in international SEO
Hreflang is the foundation of every multi-market site I audit, because without it Google often shows the wrong country version, for example a German shop page with euro prices to a Swiss user. It works together with the site structure (ccTLD, subfolder or subdomain, see top-level domain), canonical tags and translated content. Google also recommends separate URLs with hreflang over serving different content by IP, because Googlebot mostly crawls from US addresses and does not send an Accept-Language header. That is why IP-based geolocation redirects are risky for SEO.
Common hreflang errors
- Missing return links: page A points to B, but B does not point back.
- Wrong codes: en-UK instead of en-GB, or a region with no language.
- Non-canonical URLs: hreflang pointing to redirected, noindexed or 302-redirected pages.
- Missing self-reference: the page does not list itself in the set.
On large sites, each wrong URL in the set also costs crawl budget.
Hreflang and other search engines
Bing does not rely on hreflang in the same way. Its webmaster blog lists the content-language meta tag, the HTML lang attribute, HTTP headers, ccTLDs and IP lookup as its language and country signals. For markets where Bing has meaningful share, add a content-language meta tag as well.
Need a hreflang setup for Poland, Germany or the Czech Republic? See my international SEO consultancy or read the guide to SEO in Germany.
Frequently asked questions about Hreflang
Does hreflang improve rankings?
Hreflang does not raise rankings directly. It tells Google which of your existing language or country versions to show, which reduces wrong-market traffic and improves click-through and conversion.
What is x-default in hreflang?
x-default is a reserved hreflang value that marks the fallback page for users whose language settings match none of your versions. Google introduced it in April 2013.
Does Google use hreflang to detect a page's language?
Google does not use hreflang or the HTML lang attribute to detect language. It detects language with its own algorithms and uses hreflang only to pick between alternate versions.
Should I use hreflang in the sitemap or in HTML?
Use either one, because Google treats HTML tags, HTTP headers and XML sitemaps as equivalent. Sitemaps are easier to maintain on large e-commerce sites with many language versions.
Related terms
- Tell Google about localized versions of your page · Google Search Central
- New markup for multilingual content · Google Search Central Blog
- Introducing x-default hreflang for international landing pages · Google Search Central Blog
- How Google crawls locale-adaptive pages · Google Search Central
- How To Tell Bing Your Website's Country and Language · Bing Webmaster Blog







