Hreflangs. How to Tag the Language Versions of Your Website?

Hreflangs. How to Tag the Language Versions of Your Website?

A surprising fact: according to the research conducted by SEMrush in 2017, approx. 75% of multilingual websites have no hreflangs, or they have been implemented improperly. Therefore, a question may easily arise: how, and why should you use hreflangs?

Table of contents:

  1. What is a hreflang?
  2. Implementation
  3. Managing hreflangs and technical aspects
  4. Useful tools
  5. What to pay attention to – the most frequent mistakes
  6. Conclusion

Thanks to a detailed analysis performed by SEMrush with its tool, it was possible to check whether 20 thousands of analysed pages have implemented the hreflang tag properly, according to Google standards. The results showed how many mistakes were made when it comes to hreflang implementation. The main conclusion coming from this research is that ¾ of the analysed websites used the attribute improperly, or didn’t use it at all.

What is a hreflang?

Hreflang tag serves to inform the search engine bots that a given website has various language versions, meant for the visitors who speak different languages or come from different regions – i.e. countries with the same official language, such as Germany and Austria. It is, therefore, one of the important aspects of international SEO.

In HTML language, there’s a lang attribute that describes the content of a given site. It doesn’t mention the availability of other language versions, though – and this is precisely what hreflangs are for. In practice, we get two important benefits of using them:

  1. Hreflangs can actually decrease the bounce rate since visitors are redirected to the most appropriate version of the website.
  2. Pages linked to one another with hreflangs won’t be treated as a duplicated content. That could happen in the case of separate sites for visitors coming from the US and Great Britain – the content would be similar, with only a few differences such as currency or travel costs. Thanks to hreflangs, we can inform the search engine bots that it’s still the same content, but it’s meant for a different audience.

John Mueller himself, who is often named as “the link between Google and the rest of the world”, admitted that hreflangs are one of the most complex aspects of SEO in his opinion. He was even asked to record a video on that topic – but he explained that it would take a proper online course rather than a 5-minute movie to clarify it. Nonetheless, he added that basic use and implementation are not that difficult.

Search engines that support hreflangs

Hreflangs are interpreted “only” by three search engines. But, the fact that one of those three is Google makes it much more relevant. The other two engines are Yandex and Seznam. In other cases, we’ll have to count on the language tag (<meta lang=”xx”>). Still, only Google handles hreflangs implemented differently than in HTML code.

The way hreflang works

When implemented properly, the hreflang attribute will inform the search engine bots about all the language versions available. When the search engine user starts the research, Google will first determine which address to put where in the search engine results page, and then check whether there are other language versions of the website that might suit the user better.

How does tag for language specific version of the page work?

Hreflang attribute vs. Google rank

As a result, hreflangs shouldn’t be treated as a ranking factor. Optimizing or building links to only one language version won’t affect the other versions of the site in terms of their position in SERP. Not directly, that is. Implementing such attributes properly will help you decrease the bounce rate and eliminate duplicated content, which can easily influence the rank of the website.


Basically, hreflang implementation can be done in three different ways:

  1. In the head section
  2. In HTTP headers
  3. In the XML sitemap

Hreflangs in the head section

The tag will have the following structure:

<link rel=”alternate” hreflang=”language_code-region_code” href=”website-url”>

The language code should be inserted accordingly to the ISO 639-1, format, whereas region code (according to ISO 3166-1 Alpha 2 format), is optional. Below you’ll find more details on when it’s worth using it. Still, the URL address should be absolute.

We have to add a proper hreflang tag to every language version of the website, as well as an additional URL that drives traffic to a given subpage. In order for the implementation to be correct, such a combination of hreflangs should be inserted on every version of the site.

For example, if our website is available in three language versions: Polish, English, and German (excluding the actual countries) – (pl), and http:/, then on every site, we have to input the whole combination:

<link rel=”alternate” hreflang=”pl” href=””>
<link rel=”alternate” hreflang=”en” href=””>
<link rel=”alternate” hreflang=”de” href=””>

As can be seen, we always add the tag with a link to a website to which we add this combination.

Additionally, it’s worth adding an extra tag that will take into account the visitors who don’t speak any of those languages. In this case, the best solution is to redirect them to the English version of the site, therefore:

<link rel=”alternate” hreflang=”x-default” href=””>

You’ll read more about x-default hreflang below.

Hreflangs in HTTP headers

HTTP header is another piece of information attached to the requests sent to and by servers (“cookies” serve as a good example of such headers). This method is useful when it comes to files that have no HTML format – i.e. PDFs.

The header should have the following format:

Link: <url-1>; rel=”alternate”; hreflang=”language_code_1-region_code_1”, <url-2>; rel=”alternate”; hreflang=”language_code_2-region_code_2”, …

The language and region codes are corresponding to HTML tags. If we go back to our example, the headers will look as follows:

Link: <>; rel=”alternate”; hreflang=”pl”,  <>; rel=”alternate”; hreflang=”en”, <>; rel=”alternate”; hreflang=”de”

To each language version of the website, there should be the same combination of headers used, in which specific parameters are separated with commas. The parameter redirecting to the current web page should be included in this set as well.

Hreflangs in the XML sitemap

Hreflangs can also be implemented with relevant tags in the XML sitemap. The template for two language versions of one subpage looks as follows:

<xhtml:link rel="alternate" hreflang="language_code_1-region_code_1"  href="url-1" />
<xhtml:link rel="alternate" hreflang="language_code_2-region_code_2"  href="url-2" />
<xhtml:link rel="alternate" hreflang="language_code_1-region_code_1"  href="url-1" />
<xhtml:link rel="alternate" hreflang="language_code_2-region_code_2"  href="url-2" />

It means, then, that in our case there should be the following code included in the XML sitemap:

<xhtml:link rel="alternate" hreflang="pl"  href="" />
<xhtml:link rel="alternate" hreflang="en"  href="" />
<xhtml:link rel="alternate" hreflang="de"  href="" />

<xhtml:link rel="alternate" hreflang="pl"  href="" />
<xhtml:link rel="alternate" hreflang="en"  href="" />
<xhtml:link rel="alternate" hreflang="de"  href="" />
<xhtml:link rel="alternate" hreflang="pl"  href="" />
<xhtml:link rel="alternate" hreflang="en"  href="" />
<xhtml:link rel="alternate" hreflang="de"  href="" />

General rules for hreflang implementation

Apart from the above-mentioned guidelines, there are a few more rules we should take into account when implementing hreflangs.

  • Always consider all language versions and a current subpage.
    language specific version tag for 2 sites
    We have two language versions – both are linked with hreflangs. As a result, there will be two hreflangs on each version – one for the alternative version, and one to the current version plus x-default. This doesn’t seem that complicated… Yet.
    hreflang implementation for 3 sites
    Having three language versions means that each of them will be linked to others. Therefore, we should have three hreflangs on each subpage – one linking to the current subpage, two to other language versions, plus x-default on every one of them.

    Hreflang implementation on 4 and more websites
    Each subsequent language version (or one dedicated to a specific region) needs its own hreflang to be added.

  • All the URL addresses have to be full (with the http/https protocol).
  • We can also mix the addresses coming from different domains and subdomains, not only language catalogues (i.e. and, or and http://mywebsite.en)
  • In order for the hreflang to be taken into account by the search engine bots, both subpages have to link to one another. It’s for security reasons – basically, no one else can tag your website as an alternative version of theirs.
  • Hreflangs should be added on every subpage, with accurate URL paths. Linking only your main pages won’t be enough!
  • There’s no difference when it comes to the sequence in which we add subsequent versions of the website. The version that is tagged the most accurately, with the language code and region code, will be indicated first – then, the one that has the language code, whereas the last one will include x-default parameter.
  • It’s always worth to set up the x-default parameter for those users who we didn’t specify the language for, redirecting them to the most popular language version.
  • In order for Google to take hreflangs into account, all connected pages have to be in the index.
Expert Comment

If I had to point out one piece of advice for anyone planning to start implementing different language versions to the website it would be: don’t rush. It’s a step that can really weigh on the effectiveness of your SEO, so it can’t be an impulsive choice. Take your time and consider your options, possible technical solutions to make sure that implementation of the new language version will be effective & will be working for your business

Matt Calik Delante
Matt Calik
Head of SEO & SEM

BONUS: Google Tag Manager

Google Tag Manager provides another opportunity to implement hreflangs. This method, however, is not included in the official Google documentation. Their authors claim that it works, though. Some of the elements listed might seem debatable, but many specialists say that GTM gives a lot of possibilities when it comes to SEO.

The whole concept is based on the usage of “Element DOM” variable. Thanks to this variable, it’s possible to build a tag which will dynamically generate hreflangs for every subpage. This method might seem complicated for someone who doesn’t have experience with Google Tag Manager or JavaScript – but all you have to do is to set it all up once and you can be sure that GTM will automatically generate the right set of hreflangs for every page.

You can find a detailed instructions on how to set up the tag on the SearchVIU blog. At the end of this blog post, you’ll find an example that proves that this method works. Theoretically – it should, but using JavaScript might raise doubts whether Google bots will manage to render such a code fragment in every case.

Managing hreflangs and technical aspects

Choosing the implementation method

The implementation of hreflangs with HTML tags or HTTP headers can be inconvenient, especially if we have more than a few language versions. It’s mostly due to the fact that it increases the number of database requests that has to generate those links. Additionally, for 20 language versions, the code needed for proper hreflang implementation will weigh approximately 1,5 KB. It doesn’t seem like much, but it will influence the page load speed, which is currently one of the important ranking factors. Basically, every second counts – which is why we should always stick to as few hreflangs as possible.

Adding the hreflang attribute to the XML sitemap, on the other hand, seems like the best solution for complex, multilingual sites. We don’t burden the subpages, which affects their speed. Simplicity is another benefit – it’s easier to implement and manage hreflangs from one place, rather than editing every single subpage.

Language and region codes

Hreflangs make it possible to link not only different language versions of the website but also the same language versions that are meant for visitors from different countries. It’s especially important when we address the visitors coming from multilingual countries.

For example: if our website is in English, but we have two different versions for the visitors coming from the US and Great Britain, then we should add relevant tags: “en-US”, or “en-GB”. The website, however, can also be visited by Australians, Canadians, or any other English-speaking users. T

For example: if our website is in English, but we have two different versions for the visitors coming from the US and Great Britain, then we should add relevant tags: “en-US”, or “en-GB”. The website, however, can also be visited by Australians, Canadians, or any other English-speaking users. There’s no need to specify the hreflang for each country because you can add only the language code “en” and determine which versions should be displayed to those who are not from the US or Great Britain.

Another example: We operate in Switzerland, which is why we maintain the website in two languages: German and French. We should then have four different language versions:

  • A French version of the website for Switzerland  (hreflang=”fr-ch”)
  • A German version of the website for Switzerland (hreflang=”de-ch”)
  • General French version (hreflang=”fr”)
  • General German version (hreflang=”fr”)

We’re not limited in any way by the official languages of a given region. We can mix languages and regions however we want to. For example, if we wish to create a subpage for German-speaking users in France, we would use hreflang=”de-fr”.

In some cases, the language tag can be extended with subtags, i.e. Extended Language Tag (according to the ISO 339-3 classification) or Script (ISO 15924). Such a situation can occur when our website is, as an example, in Uzbek – but in the Latin alphabet. Then, we would use “uz-Latn”. This example shows exactly how rare such cases are.

X-default attribute

At the very beginning, the x-default variable in hreflangs was meant to redirect the visitors to the international version of the website. Currently, however, it aims to serve the users whose language and location are not related to any hreflangs. Coming back to the US-Great Britain example: technically, we could replace the “general, English-speaking” URL with an address including x-default, because both of them would redirect to the same website. Still, it’s better to keep both, since a URL with “en” tag would make it easier for the crawlers to understand the content of the website.

Hreflangs vs. canonical addresses

Hreflangs don’t replace canonical links in any way – they should complement each other. In fact, a hreflang tag added to a site without a canonical tag simply won’t work. We should then add the canonical tag to every subpage. Therefore:

  1. On the website we should add:

<link rel=”cannonical” href=””>
<link rel=”alternate” hreflang=”pl” href=””>
<link rel=”alternate” hreflang=”en” href=””>
<link rel=”alternate” hreflang=”de” href=””>

  1. On the website http://mywebsite.comen:

<link rel=”cannonical” href=””>
<link rel=”alternate” hreflang=”pl” href=””>
<link rel=”alternate” hreflang=”en” href=””>
<link rel=”alternate” hreflang=”de” href=””>

  1. On the website

<link rel=”cannonical” href=””>
<link rel=”alternate” hreflang=”pl” href=””>
<link rel=”alternate” hreflang=”en” href=””>
<link rel=”alternate” hreflang=”de” href=””>

Additionally, if our site has separate mobile (f.ex. AMP) and desktop versions, there will be some modifications needed. On the we can find a chart that shows how such an implementation should look like. These guidelines were actually inspired by John Mueller and his recommendations.

Hreflangs for AMP

Managing hreflangs:

If we manage to implement hreflangs properly, it’s not the end of the road. In order not to waste our time and effort spent on the implementation, we should make sure that everything works properly at all times. Keep in mind that:

  1. If we erase a subpage in one language version, we should also update the hreflangs of its equivalents in different languages;
  2. If we set up some redirections, however, we should add hreflangs to the new address.

It’s also worth to keep in mind that when we publish other language versions of our website after Google crawls it, we have to wait for the effects of the hreflang implementation – till its crawlers visit our site again. Before that, Google will only see hreflang coming from the translation to the original, but not the other way round. In this case, when we add hreflangs to a number of subpages (or many language versions), the process of indexing those subpages with hreflangs might take a while.

Useful tools

In order to manage hreflangs properly, we might want to use dedicated tools. As already mentioned, we can take advantage of Google Tag Manager to implement hreflangs and keep an eye on them. There are many tools that are meant exactly for the management of this attribute, though.

Hreflang Tags Generator

Hreflangs tags generator

When implementing hreflangs, it’s worth using Hreflang Tags Generator. It’s simple: we indicate the addresses of all language versions of our website, we choose what language they are in (from the list provided) or choose “default” if we want to generate the x-default attribute, and optionally select a region. Then, we have to specify whether we want the code exported to the HTML file or XML sitemap, and click on “Generate the hreflang tags for these urls”. You can also upload your CSV file (with up to 50 addresses) into the form, which makes the whole process even more straightforward.

Hreflang Sitemap Tool, Flang

Hreflang Generator - Flang

Hreflang Sitemap Tool works quite similarly. Thanks to this tool, we can generate a sitemap with hreflangs, based on the URLs collected in the .csv file. In this case, we’re not limited to 50 addresses – but we do have to provide our email address. Flang is also a simple tool which allows us to check whether all hreflangs on our website work properly.


Hreflang - polyang

For website managed with WordPress CMS, we can use Polylang plug, which will let us translate various elements of the website (along with media, categories, tags, menu, and or own taxonomies). It will also be possible to add hreflangs into the head section. The plug is available for free with limited functionality.


Hreflangis- oncrawl

If we need something slightly more advanced, it’s worth giving OnCrawl a try. Thanks to this tool, we’ll be able to check whether hreflangs have been implemented properly – when they link to sites on different domains,  as well as when the attribute was added to the HTTP headers or XML sitemap. OnCrawl will also spot the most common mistakes with language and region codes and will check if all subpages have the right hreflang tags. Not to mention that the interface is really intuitive. We can take advantage of the 14-day free trial to check if we want to invest in the tool in the long run.

Screaming Frog

Hreflangs - screaming frog

Screaming Frog is also quite useful if we want to check how hreflangs were implemented. In the free version, we can scan up to 500 websites. The software will let us know whenever there’s a hreflang attribute or x-default missing, as well as to what subpages the existing hreflangs refer to, and if there are any errors. In the paid version, apart from the lack of the limit, the tool also checks hreflangs added into HTTP headers and sitemaps.

Hreflang checkHreflangs list

What to pay attention to – the most frequent mistakes

1. Wrong language/region codes

Language and region codes comprise of two letters, which are often closely related to the country names. Yet, it’s easy to make mistakes, such as “eng” instead of “en” and “UK” instead of “GB”, or simply mix up the order of these codes. Plus, there are various standards when it comes to language codes – for example, Facebook might use similar letters, but applies underscores (“_”) instead of dashes (“-”).

2. Lack of hreflang referring to the current webpage

When Google visits a certain subpage and sees some links with the hreflang attribute, it will immediately know what’s going on. Yet, the official documentation says that the link to the current webpage itself is necessary in order for hreflangs to be implemented properly.

3. Hreflang implemented only for one language version of the site

Since we implemented the hreflang attribute on a given subpage, remembering about the link to the current website, then everything should work properly, right?

Only when we added the same combination of hreflangs on every language version of this subpage. Taking into account that we can link to the URLs coming from different domains – it’s a simple, yet effective guarantee that no one will tag our website as their own.

4. Using the URLs which can’t be indexed anymore, or return the server response code that is different than 200

Similarly to the mistake mentioned above – in order for the hreflang attribute to be implemented properly, the search engine has to see him on both (or every) connected subpages. It won’t work if the search engine bot is unable to display the content of one of the pages, no matter the reason (i.e. due to 4xx or 5xx errors).
increase online visibility with well implemented hreflangs

5. Hreflang only on the main page

The main page and its language versions are often highlighted to show an exemplary hreflang implementation. It might give us the impression that the attribute on the main page is everything we need, and the search engine will connect all the remaining subpages by itself.

The problem is that It won’t. Hreflangs connect specific addresses with their equivalents in other languages, and the links have to be clear for the search engine. If the main page was enough, it would be much easier. It’s also wrong to connect subpages that are not equivalent.

6. No hreflangs implemented on the sites with national domains

If we have a site with a domain, for example, .com – then adding hreflang tags seems natural. But, if we have translated versions of the site on national domains (such as “.pl”, “.de”, “.fr”), then we might be under the impression that the search engine would know exactly which version to display in the search results.

Now, it might work in certain cases. But if we’re serious about running our own website and implementing hreflangs properly, then we shouldn’t assume that “the Google bot will probably guess which site is the best in a given case”.

7. Canonical link redirecting to the default version of the website

Since our website has a couple of language versions, then one of them is probably treated as the main, aka default version. Therefore, it might be a good idea to set the rel=canonical tag to it, coming from the remaining versions of the site.

It’s a serious mistake that would eventually make those versions disappear from the search results. It’s due to the threat of duplicated content, which is a serious problem for SEO. Nonetheless, hreflangs are a sufficient piece of information for the search engine, indicating that the connected addresses have the same content, but should be displayed differently depending on the language and location of every web visitor.

Clearly, the list of mistakes can go on. If you’re not sure whether a certain case of hreflang implementation is right, let us know in the comment section below.


There might be some complexities revolving around hreflangs – but all it takes is to stick to a few simple rules and implement them gradually in order to improve the rank in search results. Choose the method of implementation (such as HTML headers or XML sitemap) that suits your needs best. Remember about having the right combination of hreflangs on every subpage, including the links to a current page.

Also, always stick to the lowest number of hreflangs possible. Check the correctness of language and region codes thoroughly, keep an eye on the implemented hreflangs, and make changes if needed. Remember that there are certain tools that can help you with that.

Thanks to proper hreflang implementation, you can beat even 75% of other websites around the globe. It seems to be worth the effort, don’t you think?


Hreflang is a tag that gives Google crawlers information about different language versions of the website. Thanks to that, Google will be able to provide its users with adequate versions of your site depending on the language they use.

Two main advantages of using hreflangs on your multilanguage website are:

  • decreasing the bounce rate,
  • protecting your website from being seen as duplicate content by Google bots.

Check a more detailed description of each benefit in the article above! 🙂

Hreflangs can be complicated to implement sometimes but it’s important to make it in the correct way. Here are some of the most common mistakes when it comes to hreflangs:

  • wrong language/region codes
  • no hreflangs referring to the current webpage,
  • implementing hreflang for just one language version of the site,
  • using wrong URLs,
  • implementing hreflang on the main page only,
  • the canonical link that redirects to the default version of the site.

If you want to explore these mistakes, go back to the article above – we describe each of the errors!

SEO Specialist - Wojciech

SEO Specialist

In Delante from November 2018. A historian and journalist by education, although his first steps in his professional career led him to the path of Internet marketing and SEO. Since then, he has been following it towards the first positions in search engines. After hours engaged in the Light-Life Movement, fantasy novels and HoMM 3.
Comments (2)

Leave a Reply

Your email address will not be published. Required fields are marked *

Recently on our blog

Are you curious about SEO of online stores or maybe you want to enter the Swiss market and wonder SEO abroad looks like? You will find answers to these questions and many other tips important for the development of your business on our blog.

Google Core Algorithm Update - May 2022

Google Core Algorithm Update - May 2022

It’s already a tradition that we write about the core algorithm update in May or June. Google releases a broad core update several times a year. Check out what it might mean for your website, is there anything to be afraid of?

Read more
Does Link Building Increase Organic Traffic? Importance of Link Building in 2022 Proved

Does Link Building Increase Organic Traffic? Importance of Link Building in 2022 Proved

Link building is an important element of every SEO strategy. Although it’s frequently disregarded, it can bring spectacular results when done properly - we managed to achieve 800% revenue growth! Selecting appropriate keywords and obtaining backlinks from thematically related websites will help you boost organic traffic to your site. Need proof? Read today’s article based on real-life examples!

Read more
Voice Search SEO in 2022. How to Optimize Your Website for Voice Search?

Voice Search SEO in 2022. How to Optimize Your Website for Voice Search?

Google Assistant makes voice search a really powerful tool. It can schedule appointments, set clock alarms, or calculate your route home from work. It helps you find products to buy and gives you search results matching your location. This solution is predicted to become the most popular research method by 2025. How to optimize your website for voice search and stay on top of the game? Keep reading!

Read more