Hreflang

What Is The Hreflang Tag?

The hreflang tag is an HTML attribute that helps search engines understand the language of a web page.

It signals to Google which web page version they should show a user based on their geographical location and language.

Here’s what I mean:

Imagine someone in Spain makes a search on Google, and you have content in both Spanish and English that answers that search.

Naturally, you want Google to show them the Spanish one, right?

That’s where the hreflang tag comes into play. It tells Google the language of your page so it knows which version to show.

Simple as that!

The truth is that hreflang tags are probably one of the most complicated parts of SEO. But they can also be extremely important for your overall strategy!

learn how to increase your search traffic in 28 days

Why Are Hreflang Tags Important?

Hrefland tags are important for international SEO to specify which languages and geographical locations a web page is for.

If you have multiple versions of the same web page in different languages, you must implement hreflang correctly.

Here’s why:

    • Better User Experience: Direct users to pages in their preferred language or region, lowering bounce rates and boosting engagement.
    • Avoid Duplicate Content: Hreflang tags specify language and region, avoiding search engine penalties for duplicate content.
    • More SEO Traffic: Correct use of hreflang tags boosts visibility in regional searches, driving more traffic from different countries.

The bottom line is that Hreflang tags are important for websites with content written in different languages.

They can boost your SEO, help you reach new audiences in different countries, and ultimately increase your website traffic.

Who doesn’t want that, right?

Want us to rank your site?

What Does A Hreflang Tag Look Like?

Hreflang tags look like this:

<link rel=”alternate” href=”https://example.com/en-us/” hreflang=”en-us” />

Here’s the breakdown of what each element in the hreflang tag means:

    • rel= “alternate” – Indicates an alternate version of the page.
    • href= “https://example.com/en-us/” – Specifies the URL of the alternate version.
    • hreflang= “en-us” – Explains the language (English) and region (United States).

what does a hreflang tag look like?

Hreflang tags are generally added to the page’s HTML <head> section. But it depends on your situation and goals.

We have publish tons of SEO case studies

When Should You Use A Hreflang Tag?

You should use a hreflang tag when you have multiple versions of the same page in different languages.

This will ensure that search engines understand which version of a page they should serve to individual users.

Here are three scenarios when we typically use hreflang tags:

  1. When the client’s site is available in multiple languages
  2. For client sites targeting different regions with specific content versions (e.g., US, UK, Canada)
  3. For clients with large company websites operating in multiple countries with localised content

If your site fits one of those scenarios, it’s worth considering adding hreflang tags.

download the link building checklist

How To Create A Hreflang Tag

Follow these steps to create a hreflang tag correctly:

Choose Language Codes

Use ISO 639-1 codes for languages.

For example “en” for English or “fr” for French.

This ensures you’re using standardised language codes that Google understands.

Determine Region Codes

Next, determine the region codes.

This is also important if your content targets different regions that speak the same language (e.g. the US and the UK).

Use the ISO 3166-1 Alpha 2 codes to allocate regions, such as “US” for the United States or “FR” for France.

These region codes tell Google the geographical target of your content.

Combine The Codes

Now, simply combine language and region codes to form the hreflang attribute.

For English and the United States the combined code is “en-us”.

For French and France it would be “fr-fr”.

Not so hard, right?

Record each language and region code on a spreadsheet so you have a record for yourself. Then, it’s time to add the hreflang tags to your site.

Check your not using blacklisted backlinks here

How To Add Hreflang Tags To Your Site

There are three ways to add Hreflang tags to your site:

  1. HTML Tags – Best for static websites or smaller websites.
  2. HTTP Headers – Best for not HTML pages or files like PDFs.
  3. XML Sitemaps – Best for large websites with tons of pages.

Note: Adding hreflang tags to your site is tricky (probably one of the most complex parts of SEO).

If you aren’t confident, get an SEO specialist to help you out.

Below is a simple overview of each.

HTML Tags

This is the easiest way to implement the hreflang attribute on your site. It’s also ideal for beginners and smaller websites.

Add the hreflang tags within the <head> section of each website. Remember that each line needs a separate tag.

Here’s an example of how it should look:

<head>

<link rel=”alternate” href=”https://example.com/en-us/” hreflang=”en-us” />

<link rel=”alternate” href=”https://example.com/fr-fr/” hreflang=”fr-fr” />

<link rel=”alternate” href=”https://example.com/de-de/” hreflang=”de-de” />

</head>

HTTP Headers

This is advanced, so you might need an SEO or web developer to implement it for you.

Add the hreflang tags to your server’s configuration files. The process will be different depending on your server type.

Below is an example of the code for both Apache and Nginx servers.

Apache:

<Files “index.html”>

Header set Link ‘<https://example.com/en-us/>; rel=”alternate”; hreflang=”en-us”‘

Header add Link ‘<https://example.com/fr-fr/>; rel=”alternate”; hreflang=”fr-fr”‘

Header add Link ‘<https://example.com/de-de/>; rel=”alternate”; hreflang=”de-de”‘

</Files>

Nginx:

location / {

add_header Link ‘<https://example.com/en-us/>; rel=”alternate”; hreflang=”en-us”‘;

add_header Link ‘<https://example.com/fr-fr/>; rel=”alternate”; hreflang=”fr-fr”‘;

add_header Link ‘<https://example.com/de-de/>; rel=”alternate”; hreflang=”de-de”‘;

}

XML Site Maps

To do this, you will need to modify your sitemap.

You will add the hreflang tags directly within your XML sitemap file, creating one URL entry per page.

Here’s an example of how it looks:

<url>

<loc>https://www.example.com/</loc>

<xhtml:link rel=”alternate” hreflang=”en” href=”https://www.example.com/” />

<xhtml:link rel=”alternate” hreflang=”de” href=”https://www.example.com/de/” />

<xhtml:link rel=”alternate” hreflang=”fr” href=”https://www.example.com/fr/” />

</url>

<url>

<loc>https://www.example.com/about/</loc>

<xhtml:link rel=”alternate” hreflang=”en” href=”https://www.example.com/about/” />

<xhtml:link rel=”alternate” hreflang=”de” href=”https://www.example.com/de/about/” />

<xhtml:link rel=”alternate” hreflang=”fr” href=”https://www.example.com/fr/about/” />

</url>

I hope this has made the Hreflang tag a bit easier to understand.

If you want to learn more SEO quick wins, check out my free course:

increase your organic search traffic in 28 days
Link Building

Link building you will be proud of.

Learn more
SEO Agency

We take full control of your traffic.

Learn more
Learn Portal

Free SEO tutorials to increase your traffic.

Learn more

Frequently Asked Questions

Yes, hreflang is good for SEO. It helps search engines understand the language and regional targeting of your pages. This improves user experience, tells Google which page they should show users and avoids duplicate content issues.
Hreflang is not a direct Google ranking factor. But, it indirectly influences rankings by ensuring users see the most relevant version of your site. A user reading a page in their language can improve engagement and reduce bounce rates, which impacts rankings.

Increase Your Search Traffic
In Just 28 Days…

CLICK HERE TO GET STARTED I’ll show you how step by step

Featured In: