SEO Glossary / Hreflang

Hreflang

What is Hreflang?

Hreflang is an HTML attribute that informs search engines about the multiple versions of a page for different languages or regions. It helps Google serve the correct localized version to searchers.

There are three ways to apply the hreflang attribute:

  • HTML tags
  • HTTP headers
  • Sitemaps

Here’s how hreflang is implemented in the HTML code of a blog homepage:

<link rel="alternate" href="https://example.com/blog/" hreflang="x-default">
<link rel="alternate" href="https://example.com/blog/" hreflang="en">
<link rel="alternate" href="https://example.com/blog/zh/" hreflang="zh-Hans">
<link rel="alternate" href="https://example.com/blog/ru/" hreflang="ru">
<link rel="alternate" href="https://example.com/blog/de/" hreflang="de">
<link rel="alternate" href="https://example.com/blog/es/" hreflang="es">
<link rel="alternate" href="https://example.com/blog/it/" hreflang="it">

Why is Hreflang Important for SEO?

Hreflang is important for SEO because it helps search engines discover and serve the relevant localized version of your pages based on the user’s language and/or region. It’s one of the crucial components of international SEO while expanding your online presence in multiple countries.

Moreover, the group of hreflang pages shares each other’s ranking signals. According to Google’s Gary Illyes, the page that is the best match will determine the ranking position, but the most relevant page for a user will be shown in the SERPs. Thus, hreflang tags can impact your rankings directly.

Besides, hreflang is also one of the effective ways to resolve duplicate content issues on your site. Let’s say you’re targeting the audience in the US and UK with two different versions of the same page. Apart from minor differences like some spellings, currencies, etc., the rest of the content on both pages will be identical. So you need to signal Google about two different versions with hreflang.

Hreflang Best Practices

To implement hreflang tags correctly, follow these best practices:

1. Always Use Self-Referencing Hreflang Tag

Whenever you apply hreflang tags on a page, ensure that you’ve added a self-referencing hreflang link to that page. For example, if your site has the following English and Italian versions of a page:

<link rel="alternate" hreflang="it" href="https://example.com/ciao" />
<link rel="alternate" hreflang="en" href="https://example.com/hello" />

2. Make Sure the Language and Region Codes are Valid

Googlebot identifies the value of the hreflang attribute with the help of language and region codes. Google-approved format for language code is ISO 639-1 and ISO 3166-1 Alpha 2 for region code. While the language code is mandatory, the region code is optional in the hreflang attribute. For example, if you’re targeting the UK, the language-location code must be en-gb, not en-uk.

3. Add “x-default” Tag for Unmatched Languages

The hreflang x-default tag tells Google that the page is for every other language that is not specified in the hreflang section. It acts as a fallback page to be shown to users that don’t match the specified language codes.

<link rel="alternate" hreflang="x-default" href="https://example.com/" />

4. The Set of Hreflang Tags Must Be Identical on All Page Versions

Ensure the hreflang tags are identical across all page versions. Every page in the group must have the exact same set of hreflang links.

FAQs

How to Generate Hreflang Tags?

You can write the hreflang tag manually, or you can use tools like the Hreflang Tags Generator that help you generate it automatically. Just fill in the details, and it’ll provide you with the correct hreflang tags for your pages.

How to Find Hreflang Issues?

To find hreflang issues for individual pages, you can use the Hreflang Tags Testing Tool. For checking hreflang issues for your entire site, tools like Ranktracker's Web Audit can be helpful. It’ll crawl all the pages on your site, highlight all the issues (including hreflang issues), and provide detailed reports.

SEO for Local Business

People don't search for local businesses in the Yellow Pages anymore. They use Google. Learn how to get more business from organic search with our SEO guides for local businesses.

Start using Ranktracker for free!

Find out what’s holding your website back from ranking

Get a free accountOr Sign in using your credentials
Start using Ranktracker for free!