Making your website multilingual using hreflang tags? While hreflang tags are a must-have for helping people view the appropriate language and regional versions of your web pages, be sure to use the right hreflang language codes when adding hreflang tags to your website.
There are many hreflang language codes available, and they might not be as intuitive to guess as you might think. As an example, the hreflang language code for the Simplified Chinese language isn’t “ch”, but “zh”. Using the wrong language codes can mean sending visitors to the wrong language version of your web pages and creating a poor user experience as a whole.
With this in mind, let’s take a look at what hreflang language codes are and how you can easily implement them on your website. We’ll also share a list of hreflang language codes for convenient reference.
What are hreflang language codes?
Hreflang language codes are two-letter language codes used in hreflang tags to indicate the language that a web page is in. As you may already know, hreflang tags are HTML code snippets that signal to search engines the language and geographical region for which a particular web page was created. If you need a refresher on hreflang tags, we’ve got a comprehensive guide to hreflang tags here.
Each language has a specific language code – for example, the hreflang language code for Spanish is “es”, while the German language has the “de” language code. (We’ll provide a fuller list of language codes shortly.) To help search engines accurately identify the language of your web content, you’ll need to use the correct language code in your hreflang tags. You can’t simply use random two-letter combinations that suit your fancy!
While you can use hreflang language codes on their own, it’s best to use them together with the ISO 3166-1 alpha-2 hreflang regional codes. This helps give search engines a full picture of which language and geographical region a particular web page is meant for. That’s because people in different countries may seemingly speak the same language, but with regional variants in spelling or slang.
As an example, “en” is the language code for English. Just from looking at this language code, though, you wouldn’t know whether it’s referring to American English or British English. And there are differences between the two, such as how Brits spell the word “colour” with a “u”, while Americans spell the same word as “color.”
Hence, for more accurate language and geographical signposting, pair the “en” language code with the “US” and “GB” regional codes for the United States and the United Kingdom respectively. By doing so, you clarify to search engines which web page is meant for English language searchers from the United States, and which one is meant for English language searchers from the United Kingdom. This in turn ensures effective international SEO (search engine optimization) for your website.
What are the hreflang language codes used for different countries?
The hreflang language codes are based on the ISO 639-1 list of language codes set by the International Organization for Standardization. Here are some of them:
|Name of language||Hreflang language code|
|Tonga (Tonga Islands)||to|
How to implement hreflang tags (and their language codes)
Before you can reap the benefits of hreflang tags, you’ll need to add them to your website. We’ll go through two main ways, including how you can specify the appropriate language codes in your hreflang tags:
1. Manual hreflang implementation
To manually implement hreflang tags on your website, go to the head section of a web page that you want to add hreflang tags to. Then, compose your hreflang tag there, including the language code and (if relevant) regional code. Don’t forget that your hreflang tag attributes on a web page will also need to point to not just that web page, but also to its alternate language and regional variants.
As an example, you might have a global web page in English with the “https://www.example.com” URL. You also have an English version of the page for people from the United States, and a Portuguese version for people from Brazil. Accordingly, you should add the following hreflang tags to your global web page:
- <link rel=”alternate” href=”https://www.examplesite.com/” hreflang=”en” />
- <link rel=”alternate” href=”https://www.examplesite.com/us/” hreflang=”en-US” />
- <link rel=”alternate” href=”https://www.examplesite.com/br/” hreflang=”pt-BR” />
Repeat the above process for all the remaining web pages on your website.
We’ve also prepared a video demonstrating how to add hreflang tags to your website:
The manual method of implementing hreflang tags isn’t recommended
As you might be able to tell, manually implementing hreflang tags can take up a lot of time. This is especially if you have many web pages and need to create many hreflang tags. Even if you’re a web developer, you can expect to spend quite a bit of time adding hreflang tags to all the web pages on your website.
Apart from that, we don’t recommend manual hreflang implementation because:
- It can slow your pages down: The more lines of code you add to your web pages, the longer your pages will take to load. This can affect your rankings on the search engine results pages (SERPs), as search engines generally prefer to rank pages with faster page load speeds. In addition, if your web page is taking too long to load, impatient visitors may just “bounce” and leave without browsing any further pages on your website. Not only does your bounce rate go up, which can hurt your SEO efforts, but you may also lose customers.
- It leaves a lot of room for mistakes: Prepare too many hreflang tags and they can all start to blur together, causing you to make common mistakes. For instance, you may use the wrong language codes or country codes, or format your hreflang tags incorrectly. Search engines may then end up serving the wrong language content to the wrong searchers. If you see a “Your site has no hreflang tags” message in Google Search Console, this is a sign that there’s an error with your hreflang implementation that needs fixing.
2. Using Weglot
As we’ve seen, it can be quite painful to manually add hreflang tags to your website. And frankly, the risk of inaccurate hreflang implementation isn’t worth it when our Weglot website translation solution presents a much simpler, no-code alternative.
Weglot works by detecting and translating your original content into your destination languages of choice, and then displaying that content without the need for duplicate sites. At the same time, Weglot will add the appropriate hreflang tags to the language and regional variants of your web pages. This happens instantly and in the background, without you needing to fiddle with any HTML code.
As a powerful website translation solution, Weglot also ensures that your web pages are translated to a high degree of accuracy. It does so by using a proprietary mix of some of the best machine language translation providers in the market, such as DeepL. Afterward, you have the option of refining your translations on your own, or engaging professional translators from the Weglot dashboard to polish your translations to perfection.
Weglot is compatible with all major website platforms such as WordPress and Shopify. Installation is easy: in WordPress, for example, you’ll sign up for a free 10-day Weglot account and install the Weglot WordPress plugin to get started.
Hreflang language codes FAQs
Are hreflang language codes case-sensitive?
No, they’re not. However, the ISO recommendation is to display the language codes in lowercase, and the regional codes in uppercase.
Hreflang x-default: what is it and can it replace language codes?
The “x-default” hreflang attribute indicates that a web page doesn’t cater to any particular language or geographical region. Use this attribute, instead of hreflang language codes, in web pages to which search engines should be directing users if the search engine can’t find a more appropriate web page variant.
Can you use custom hreflang language codes?
If you’re using Weglot to add hreflang language codes to your website, you can easily change the default language codes to something else. To do so, you’ll need to insert certain code snippets into your website. We have more information on this here.
How can you troubleshoot hreflang tag errors?
Not sure if your website’s hreflang tags are working properly? We’ve got a tool to simplify the troubleshooting of hreflang tag errors – just head over to our Hreflang Checker and key in the URL that you’d like to check for hreflang issues.
From there, you can review the hreflang tags we’ve discovered on the web page and troubleshoot further if any hreflang tags appear to be missing from the list.
Ensure fast and accurate implementation of hreflang language codes with Weglot
Using hreflang language codes is pretty straightforward in theory: identify the correct language codes for your web pages, then type up your hreflang tags and insert them into your website accordingly. But in practice, manually adding hreflang tags can be quite a chore, and also comes with the risk of inaccurate implementation.
This is why we’d strongly recommend adding hreflang tags the automated way using Weglot. It makes hreflang implementation as simple as specifying the original and destination languages of your content. Anyone can do it, even if and especially if they aren’t tech-savvy. And with Weglot being a fast worker, your hreflang tags will be added instantly, no matter how many of them you need.
If you’re using hreflang language codes to designate the languages of different web pages, then you’ll additionally need to translate your web page content in the first place – which is also something that Weglot takes care of!
So if you’re using WordPress, Shopify, or some other leading website platform and need assistance with web page translation and hreflang implementation, why not give Weglot a try? Simply sign up for a free 10-day trial of Weglot here to get started.