Understanding Canonical URLs and Hreflang for Google SEO
Last Modified:
How do you tell Google to show the multilingual website page to a specific audience?

When you have a website with multiple languages or country-specific versions, how does Google know which page to show to users?
For example, imagine you have a website available in English and Spanish. You may also have different versions of the same language for different countries. How can you tell Google which page is the preferred version and which one should be displayed to a particular audience?
This is where canonical URLs and hreflang come into play.
I have been looking at how these two SEO elements work together, particularly when a website has multiple country and language versions. Although they serve different purposes, both help search engines understand the structure of your website.
Let's look at how they work.
1. Understanding the website structure
Before configuring canonical URLs and hreflang, it is important to understand how your website is organised.
For example, let's say you have a global website and a Colombian website with two language versions:
- Global website:
https://www.portal.org/(opens in a new tab) - Colombian website in Spanish:
https://www.country.co/(opens in a new tab) - Colombian website in English:
https://www.country.co/en(opens in a new tab)
Although these pages belong to the same organisation, they target different audiences.
The Spanish page is intended for Spanish-speaking users, while the English page is intended for users who prefer English.
Google needs to understand that these pages are related, but they are not necessarily duplicate pages. This is one of the reasons we use hreflang.
2. What is a canonical URL?
A canonical URL tells Google which URL should be treated as the preferred version when multiple URLs contain the same or very similar content.
For example, you might have different URLs pointing to the same page because of tracking parameters or other URL variations.
Without a canonical tag, search engines may have difficulty understanding which version should be prioritised.
You can define the preferred URL using the following HTML tag:
<link rel="canonical" href="https://www.country.co/" />
In this example, Google is being told that it https://www.country.co/ (opens in a new tab) is the preferred URL.
One important point: each language version should normally have its own self-referencing canonical URL.
For example:
Spanish page:
<link rel="canonical" href="https://www.country.co/" />
English page:
<link rel="canonical" href="https://www.country.co/en" />
This is important because the Spanish and English pages are not duplicates. They are separate language versions with different content for different audiences.
You should not use the Spanish URL as the canonical URL for the English page, or the other way around.
3. What is hreflang?
Now that we understand canonical URLs, let's look at hreflang.
Hreflang is an HTML attribute that helps Google understand the language and regional audience of a particular page.
It tells search engines that there are alternative versions of the same content available in different languages or for different regions.
For example, you can use:
es-CO: Spanish for Colombia.en-CO: English for Colombia.es: Spanish, without specifying a country.en: English, without specifying a country.
You can add these annotations inside the HTML <head> section of your page.
For the Spanish page:
<head> <link rel="alternate" hreflang="es-CO" href="https://www.country.co/" /> <link rel="alternate" hreflang="en-CO" href="https://www.country.co/en" /> <link rel="alternate" hreflang="es" href="https://www.country.co/" /> <link rel="alternate" hreflang="en" href="https://www.country.co/en" /></head> And the same hreflang annotations should be included on the English page.
Notice that es and es-CO point to the same URL. This is possible when the Spanish page is suitable for both a general Spanish-speaking audience and users in Colombia.
The same applies to en and en-CO.
You do not need to create separate pages just to use different language codes. However, you should only include a language or regional code when the page genuinely serves that audience.
4. What is x-default?
You may also come across another hreflang value called x-default.
Unlike the other language and regional codes, it x-default is used to identify a default or fallback page for users whose language or region does not match one of the specified alternatives.
For example:
<link rel="alternate" hreflang="x-default" href="https://www.portal.org/" />
In this case, the global website is being used as the fallback page.
One thing worth mentioning is that it x-default is optional. Google does not require you to have a neutral global website or a separate language-selection page.
You can use an appropriate default page, such as your global homepage, provided it makes sense as a fallback for your website.
5. How do canonical URLs and hreflang work together?
This is where things can become a little confusing.
Canonical URLs and hreflang have different responsibilities:
- Canonical: identifies the preferred URL when there are duplicate or very similar pages.
- Hreflang: identifies alternative language or regional versions of a page.
- X-default: identifies the fallback page for users who do not match the specified alternatives.
Let's put everything together.
For the Spanish page, the configuration could look like this:
<head> <link rel="canonical" href="https://www.country.co/" /> <link rel="alternate" hreflang="es-CO" href="https://www.country.co/" /> <link rel="alternate" hreflang="en-CO" href="https://www.country.co/en" /> <link rel="alternate" hreflang="es" href="https://www.country.co/" /> <link rel="alternate" hreflang="en" href="https://www.country.co/en" /> <link rel="alternate" hreflang="x-default" href="https://www.portal.org/" /></head>And for the English page:
<head> <link rel="canonical" href="https://www.country.co/en" /> <link rel="alternate" hreflang="es-CO" href="https://www.country.co/" /> <link rel="alternate" hreflang="en-CO" href="https://www.country.co/en" /> <link rel="alternate" hreflang="es" href="https://www.country.co/" /> <link rel="alternate" hreflang="en" href="https://www.country.co/en" /> <link rel="alternate" hreflang="x-default" href="https://www.portal.org/" /></head>Notice that each page has its own canonical URL, but both pages share the same hreflang annotations.
This is important because the language versions should reference each other. These reciprocal annotations help Google understand the relationship between the pages.
Ideally, all pages in the same hreflang group should reference one another. In practice, this can become more complicated when you have a global website managed by a different team.
If you cannot update the global website, focus on keeping the language versions you control correctly configured and document any limitations. You should not add unrelated URLs just to satisfy a testing tool.
6. How can you test your implementation?
Once you have added the canonical and hreflang tags, you need to verify that everything is working as expected.
I would start with the following checks:
- Canonical URL: make sure each language page points to its own preferred URL.
- Hreflang annotations: check that the language and regional codes are correct.
- Reciprocal references: make sure the alternative language pages reference each other.
- Page availability: check that the URLs return a successful HTTP response and can be indexed.
- Google Search Console: review the indexing information and identify any issues reported by Google.
You can also use the Hreflang Testing Tool (opens in a new tab) to check whether your annotations are correctly implemented.
Keep in mind that third-party testing tools may report warnings when a referenced page does not include a matching return annotation. This is useful information, but you should investigate the actual website structure before making changes.
For example, a global website may be outside your team's control. In that situation, you need to understand the limitation rather than simply changing URLs to remove a warning.
7. Does hreflang improve Google rankings?
Hreflang helps Google understand which language or regional version of a page is relevant to a particular audience.
However, it does not guarantee that Google will display a specific page or improve its ranking.
Google uses many different signals when deciding which pages to show in search results. Content relevance, technical quality, links, indexing and user intent can all influence the result.
You may have everything correctly configured and still see a different page appearing in Google Search.
This does not automatically mean that your hreflang implementation is wrong.
It is important to remember that canonical and hreflang are signals that help search engines understand your website. They are not a way to control search rankings.
Final thoughts
When working with a website that supports multiple languages or countries, it is important to understand the difference between canonical URLs and hreflang.
They work together, but they solve different problems.
Canonical URLs help search engines understand which URL is the preferred version of similar content. Hreflang helps them identify the alternative language and regional versions. And x-default provides an optional fallback for users who do not match the specified alternatives.
The most important thing is to understand your website structure before implementing these tags. Every URL should have a clear purpose, and the annotations should reflect the actual content and audience of each page.
Getting these details right gives Google a much clearer picture of how your website is organised.
