What is hreflang?  

hreflang: marking up language and country versions correctly

Header image for the hreflang article
Ralph Grundmann · Last updated on 4 November 2026

The hreflang directive is an important tool in the field of search engine optimisation (SEO) to correctly mark multilingual or country-specific content. It helps search engines display the correct language or country version of a website to users. This improves the user experience, because visitors see the version of the website that best matches their language or region. For regional versions in the same language, such as Germany and Austria, hreflang also tells Google that the near-identical pages belong together (see duplicate content).

What is hreflang? And how does it work?

Here is the source code as an example.

<link rel="alternate" href="https://www.domain.com/de/" hreflang="de" >
<link rel="alternate" href="https://www.domain.com/en/" hreflang="en" >
<link rel="alternate" href="https://www.domain.com/it/" hreflang="it" >
<link rel="alternate" hreflang="x-default" href="https://www.domain.com/en/" />

Your website has the domain www.domain.com and the language directories “de”, “en” and “it”. For simplicity, let’s assume that each page of your domain also has an Italian and English counterpart (we will come to the exceptions later).

The code above tells Google to show the “de” directory to users whose language is German, for example in Germany, Austria and parts of Switzerland. This also applies analogously to the other two versions. This is what the first three lines of the code block state.

The fourth line states that users whose language matches none of these versions should see the English version, for example in France or Spain.

The first possible objection could be that Italian is also spoken in Switzerland. hreflang="it" already covers this; if you want to address Italian-speaking Switzerland explicitly, you can expand the code block as follows.

<link rel="alternate" href="https://www.domain.com/de/" hreflang="de" >
<link rel="alternate" href="https://www.domain.com/en/" hreflang="en" >
<link rel="alternate" href="https://www.domain.com/it/" hreflang="it" >
<link rel="alternate" href="https://www.domain.com/it/" hreflang="it-ch" >
<link rel="alternate" hreflang="x-default" href="https://www.domain.com/en/" />

The line with hreflang="it-ch" instructs the search engine to deliver the Italian page in the Italian-speaking part of Switzerland as well (provided delivery conditions and similar allow this).

How does the code work schematically?

The link tag must include the attribute “rel” with the value “alternate”. This is followed by the hyperlink reference (href), which contains the URL of the language version being referenced. The example above shows the variant for your homepage. The hreflang attribute contains either only the language or the language followed by the country. For this, you can obtain the correct codes from Wikipedia (see below):

The exception is the “fallback version”. Here the language definition uses “x-default”. This signals to the search engine that this version should be displayed when no suitable one is found.

So if you want to proceed very precisely, you can formulate the code as follows:

<link rel="alternate" href="https://www.domain.com/de/" hreflang="de" >
<link rel="alternate" href="https://www.domain.com/de/" hreflang="de-de" >
<link rel="alternate" href="https://www.domain.com/de/" hreflang="de-at" >
<link rel="alternate" href="https://www.domain.com/de/" hreflang="de-ch" >
<link rel="alternate" href="https://www.domain.com/en/" hreflang="en" >
<link rel="alternate" href="https://www.domain.com/it/" hreflang="it" >
<link rel="alternate" href="https://www.domain.com/it/" hreflang="it-it" >
<link rel="alternate" href="https://www.domain.com/it/" hreflang="it-ch" >
<link rel="alternate" hreflang="x-default" href="https://www.domain.com/en/" />

Your pages will then be shown as follows:

  • In Germany = German
  • In Austria = German
  • In the German-speaking part of Switzerland = German
  • In Italian-speaking Switzerland = Italian
  • In French-speaking Switzerland = English (see x-default)
  • In Italy = Italian
  • In English-speaking countries = English
  • German speakers in other countries, for example in Belgium or Luxembourg = German (see hreflang="de")
  • Italian speakers in other countries = Italian (see hreflang="it")
  • And because of x-default in the rest of the world also in English

Country codes are mainly worthwhile if a country has its own version, for example with its own currency or delivery terms.

That wasn’t so hard, but SEO would not be SEO if there weren’t other things to consider.

What must be considered when using hreflang?

Hreflang and index/noindex

An hreflang attribute works much like a link. Accordingly, an hreflang annotation can only refer to a target that actually exists. With hreflang, you also state that the target page should be included in the index. A “noindex” on the target page therefore sends conflicting signals.

So, for example, if the Italian page is set to noindex, we recommend removing the references to it from the other two versions.

Example: www.domain.com/de/schuhe/ refers to www.domain.com/en/shoes/ and vice versa = correct. However, www.domain.com/it/scarpe/ would be set to noindex. Then there must be no references from DE and EN, and the hreflang block on the IT version should be completely omitted (this would be the clearest signal).

Hreflang and canonical

If the three shoe pages of your domain are all set to index and the respective Canonical refers to itself (self-referencing), then you can use hreflang as described above.

However, if we assume that the German version of the shoe URL refers via canonical to www.domain.com/de/schuhshop/, this must be taken into account.

  1. domain.com/de/schuhe/ receives no hreflang and no references from the other URLs, as it has a canonical to www.domain.com/de/schuhshop/.
  2. domain.com/de/schuhshop/ receives the hreflang for IT & EN (www.domain.com/it/scarpe/ & www.domain.com/en/shoes/)
  3. IT and EN also have an hreflang block
    1. Hreflang to EN, IT and DE, but here to “schuhshop” and not to “schuhe”.
  4. DE “schuhshop” refers to “shoes” and “scarpe”

Basically, it is much simpler than it initially appears, as each of the three URLs always receives the identical block, except that the German version is replaced by www.domain.com/de/schuhshop/.

Exceptions and special cases when using hreflang

Earlier, we assumed that all three language versions are identical in content and structure. We have already touched on the first “exception” regarding the canonical issue.

So let’s assume your shop does not have men’s shoes in Italy. The entire directory is missing. Then the DE & EN versions only refer to each other and to themselves, and the reference to the Italian version is removed without replacement. This is because hreflang references to non-existent pages generate 404 errors, which is bad for crawling.

A little more care is needed when pages in the default language (x-default) are missing. Here it would be the English page. If, in the example above, the men’s shoes were also missing from the English version, you would change the x-default for the relevant pages and use, for example, the German equivalents as the default. This is valid, because for each group of pages x-default may point to whichever version actually exists. You do not need English placeholder pages for it.

Using hreflang across domains

hreflang can also be used across different domains. Above, we assumed that your shop is called Domain.com. If the three shops are accessible via different domains, you can use hreflang in the same way as in the example above.

Assumption:

  • The German shop is called: schuhshop.de
  • The English shop is called: shoes-4-u.com
  • The Italian shop is called: scarpa-moderna.it

Then the hreflang block for the homepage(s) would look as follows:

<link rel="alternate" href="https://www.schuhshop.de/" hreflang="de" >
<link rel="alternate" href="https://www.shoes-4-u.com/" hreflang="en" >
<link rel="alternate" href="https://www.scarpa-moderna.it/" hreflang="it" >
<link rel="alternate" hreflang="x-default" href="https://www.shoes-4-u.com/" />

In the case that only the domains are different, you can implement everything as described above.

It becomes problematic when the three shops do not know each other. This means that they are different shop systems on different servers. Thus, one shop cannot “know” when a URL is switched off in another. This can become very time-consuming and tricky, as all hreflang annotations would have to be maintained manually. In this case, you should sit down with your development department and look for a solution.

It becomes particularly problematic when the three shops are structured differently, i.e. when the women’s shoes sit in a completely different navigation structure than in the other shops.

In this case, you should aim for one of the following solutions:

  1. You leave everything as it is and ensure that the shops differ enough so that they are regarded by the search engine as individual country shops. This seems to be the lesser effort. However, the maintenance is very intensive. In this case, you could dispense with the hreflang attribute altogether.
  2. Or you consolidate the shops in a relaunch, retaining the domain names, and unify the shop structure into a single one. This also has the long-term advantage of simpler, central maintenance. Then you would have to use hreflang again (see above).

Our hreflang checker shows for any URL whether all language versions reference each other and themselves and are canonical.



 Your next step 

Do you need support with Hreflang?

Our page International SEO explains how we work. In an initial consultation, we clarify what makes sense for your website. We also offer training for your team.


Request a consultation
 Request a consultation 

Questions about this topic?

Tell us briefly what it is about. You will speak directly to Ralph Grundmann.
Microsoft Partner Badge
SISTRIX-zertifizierte Agentur
4.9
Based on 32 reviews

Reviews from our Google Business Profile. We check every review against our client projects.

Request a consultation
Ralph Grundmann
Ralph GrundmannFounder and Managing DirectorCall: +49 228 243 313 53

* Required

Please enter your name.

Please enter a valid email address, e.g. name@company.com.

For a call back.

Please enter your number with area code, e.g. +49 228 243 313 53.

Please tell us briefly what it is about.

Free and without obligation. We usually reply on the same working day.

Information on how we process your data: Privacy policy