SEO hreflang tags connecting international website language versions

SEO Hreflang Tags: Setup, Examples and Common Errors

Websites that publish content in multiple languages or target visitors in different countries need a clear way to help search engines understand which version of a page is intended for each audience. Without the right signals, search engines may show an English page to someone searching from France or select a regional version that does not match the visitor’s language.

This is where SEO hreflang tags become useful. Hreflang annotations tell search engines about the language and, when relevant, regional audience of alternate versions of a page. They help search engines understand the relationship between localized URLs and choose a more appropriate version for users.

However, hreflang is not a translation tool, a canonical replacement, or a guarantee that a particular URL will appear in search results. Correct implementation requires consistent URLs, valid language codes, reciprocal references, and careful technical testing.

This guide explains how hreflang works, how to implement it, which mistakes to avoid, and how to audit an international website.

What Are SEO Hreflang Tags?

Hreflang is an HTML attribute and related annotation system used to identify alternate language or regional versions of a webpage.

For example, a business may have three versions of the same service page:

  • example.com/en/ for English-speaking visitors.
  • example.com/fr/ for French-speaking visitors.
  • example.com/fr-ca/ for French-speaking visitors in Canada.

Hreflang annotations help search engines understand that these URLs are related alternatives rather than unrelated pages.

A typical HTML hreflang annotation looks like this:

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

This example identifies the linked URL as an English-language page intended for users in the United States.

Hreflang can be especially helpful for:

  • International ecommerce websites.
  • Businesses with country-specific websites.
  • Publishers producing translated content.
  • SaaS companies serving different language markets.
  • Organizations with regional product or service pages.

The important point is that each localized page should provide a useful experience for its intended audience. Adding hreflang annotations to duplicate or poorly localized pages does not automatically make them suitable for international search.

How Do Hreflang Tags Work?

Hreflang annotations describe the relationship between alternate versions of a page. Search engines can use this information to understand which language or regional URL may be more appropriate for a searcher.

Imagine an online store selling the same products in the United States, United Kingdom, and Germany.

It may have these URLs:

Target audienceExample URLHreflang value
United Statesexample.com/en-us/en-us
United Kingdomexample.com/en-gb/en-gb
Germanyexample.com/de-de/de-de

Each page should reference the other relevant versions, including itself.

This creates a connected group of alternate URLs. When search engines process these annotations, they can use the language and regional information as a signal when selecting a result.

Hreflang does not force search engines to display a particular URL. Search engines still consider page content, indexing status, canonical signals, and other factors.

Understanding Language and Country Codes

One of the most important parts of hreflang implementation is using valid language and regional codes.

Hreflang values generally follow this format:

language-region

The language code uses the ISO 639-1 format, while the optional region code uses the ISO 3166-1 Alpha 2 format.

Examples include:

  • en — English.
  • fr — French.
  • de — German.
  • en-us — English for the United States.
  • en-gb — English for the United Kingdom.
  • fr-ca — French for Canada.
  • es-mx — Spanish for Mexico.

The language portion is required when using a standard language-region value. The region is optional.

A country code alone, such as us or gb, is not a valid hreflang language value. Similarly, avoid inventing language abbreviations or using informal labels.

For example, en-uk is not the correct regional code for the United Kingdom. The appropriate value is en-gb.

When a page targets all English-speaking audiences without a specific country distinction, en may be more appropriate than a country-specific value.

How to Implement SEO Hreflang Tags

There are three commonly used implementation methods:

  1. HTML link elements.
  2. HTTP response headers.
  3. XML sitemaps.

You do not need to use all three methods on the same pages. Choose an approach that suits your website’s structure and can be maintained consistently.

1. Add Hreflang Tags in HTML

For standard HTML pages, hreflang annotations can be placed inside the document’s <head> section.

Suppose a website has United States and United Kingdom versions of a page. The US page could contain:

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

The UK version should also reference both URLs:

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

Both pages include references to the alternate versions and themselves.

For a website with several language variations, each relevant page should contain the complete set of alternate references for that group.

2. Use HTTP Response Headers

HTTP headers provide another way to communicate hreflang information.

This method can be useful for files that do not have a traditional HTML <head> section, such as PDFs.

A simplified response header might look like this:

Link: <https://example.com/en-us/document.pdf>; rel="alternate"; hreflang="en-us",
      <https://example.com/en-gb/document.pdf>; rel="alternate"; hreflang="en-gb"

The server must return the headers correctly for the relevant resource. If the site uses this approach, test the actual response rather than relying only on configuration files.

3. Add Hreflang to an XML Sitemap

Large international websites may find XML sitemap implementation easier to manage.

A sitemap can include alternate language references for each URL. A simplified example looks like this:

<url>
  <loc>https://example.com/en-us/</loc>
  <xhtml:link rel="alternate" hreflang="en-us" href="https://example.com/en-us/" />
  <xhtml:link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/" />
</url>

The sitemap must use the appropriate XML namespaces and include the corresponding alternate relationships for the localized URLs.

This method can be practical when a website has hundreds or thousands of localized pages and managing individual HTML annotations becomes difficult.

What Is Self-Referencing Hreflang?

A self-referencing hreflang annotation means that a page includes an alternate-language reference pointing to its own URL.

For example, the US English page should include:

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

It should also reference its UK English alternative if that version exists.

Self-referencing annotations help keep the alternate-language group consistent. Omitting them can create incomplete hreflang relationships and make troubleshooting more difficult.

When reviewing an international website, check that every localized page includes its own URL in the hreflang set.

Why Are Reciprocal Hreflang Links Important?

Reciprocal hreflang linking means that if page A identifies page B as an alternate version, page B should also identify page A.

For example:

  • The US page references the UK page.
  • The UK page references the US page.

This two-way relationship helps search engines verify that the pages belong to the same alternate-language group.

A missing return reference is a common implementation problem. It can happen when a new regional page is added but the existing pages are not updated.

For websites with many regional versions, automated crawling can help identify missing reciprocal links before they become difficult to manage.

What Is the x-default Hreflang Attribute?

The x-default value identifies a fallback page for users whose language or regional preference does not match one of the specified alternatives.

For example:

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

A website may use this value for a global homepage or a language-selection page.

The x-default annotation is optional. It is particularly useful when a website has a central page that helps visitors select the most suitable regional version.

It should not be added automatically to every page without considering the site’s actual international structure.

Common SEO Hreflang Errors to Avoid

Even a website with localized content can have hreflang problems that prevent search engines from interpreting its annotations correctly.

Missing Return Links

A page may reference another language version, but the alternate page does not reference it back.

Review the entire language group rather than checking only one URL.

Incorrect Language or Region Codes

Using invalid values can make annotations ineffective.

Check every language and country code against the correct standards. Do not use country abbreviations as language codes.

Missing Self-Referencing Annotations

Each page should include a hreflang reference to itself along with its alternate versions.

This is an important consistency check during an international SEO audit.

Referencing Redirected or Non-Canonical URLs

Hreflang annotations should point to the intended canonical versions of pages, not URLs that redirect elsewhere or are canonicalized to unrelated pages.

Check the destination URL’s HTTP status and canonical tag. A localized page that redirects to another country version may indicate a configuration problem.

Conflicting Canonical and Hreflang Signals

Canonical tags and hreflang annotations serve different purposes.

Canonical tags identify the preferred URL among duplicate or substantially similar pages. Hreflang identifies alternate language or regional versions.

If a localized page points its canonical tag to a different language version without a valid reason, the signals may conflict.

Review canonical and hreflang relationships together instead of treating them as separate tasks.

Using Hreflang as a Translation Solution

Hreflang does not translate page content. It only communicates the language and regional relationship between URLs.

If a page is marked as French but its content is entirely in English, the annotation does not make that page a proper French-language experience.

Create genuinely useful localized content before adding hreflang.

Redirecting Every Visitor Automatically

Automatically redirecting users based only on IP address or browser language can create problems for visitors and search engine crawlers.

A better approach is to provide clear language or country-selection options and allow visitors to access other versions when appropriate.

How to Audit Hreflang Tags on a Website

A structured audit helps identify missing annotations, invalid codes, broken URLs, and inconsistent regional relationships.

Follow these steps:

Step 1: Identify All Localized URLs

Create a list of pages that have language or country-specific alternatives.

Group related URLs together so you can compare the intended language versions.

For example:

Page typeUS versionUK versionGerman version
Homepage/en-us//en-gb//de-de/
Services/en-us/services//en-gb/services//de-de/services/
Contact/en-us/contact//en-gb/contact//de-de/kontakt/

This makes it easier to identify missing alternatives.

Step 2: Crawl the Website

Use a crawler such as Screaming Frog SEO Spider to collect hreflang information across the website.

Review:

  • Hreflang values.
  • Alternate destination URLs.
  • Missing self-references.
  • Missing return links.
  • Invalid response codes.
  • Redirecting alternate URLs.
  • Canonical conflicts.

A crawl can reveal patterns that are difficult to find by checking pages manually.

Step 3: Check HTTP Status Codes

Alternate URLs should lead to accessible pages that return the expected response.

Pay attention to:

  • 404 pages.
  • 5xx server errors.
  • Redirect chains.
  • Unexpected redirects.
  • URLs blocked from crawling or indexing.

A hreflang reference to a broken or unintended destination needs to be corrected.

Step 4: Compare Canonical Tags

Check whether each localized page has an appropriate canonical URL.

Do not assume that every language version should canonicalize to the main English page. If the localized pages are distinct versions intended for different audiences, their canonical configuration should reflect that purpose.

Step 5: Verify Reciprocal Relationships

For every alternate URL, confirm that the destination page includes the original URL in its own hreflang group.

This is particularly important when teams add new language versions or update regional URL structures.

Step 6: Test the Rendered HTML When Necessary

Some websites generate hreflang annotations through JavaScript.

If the annotations are not present in the initial HTML, inspect the rendered page and confirm that search engines can access the required information.

For a broader review of JavaScript-dependent content and search engine rendering, read our guide to testing JavaScript SEO and page rendering.

Step 7: Monitor Changes After Implementation

After fixing hreflang issues, crawl the affected URLs again.

Review the relevant pages in Google Search Console and monitor indexing and international search performance. Do not expect every correction to produce an immediate ranking or traffic change.

If your audit also reveals crawl accessibility or discovery problems, our technical guide to managing crawl budget explains how search engines discover and process website URLs.

Tools That Help You Check Hreflang

You can use several tools to inspect international SEO configuration.

ToolHow it helps
Screaming Frog SEO SpiderCrawls hreflang annotations and identifies common configuration issues.
Google Search ConsoleHelps monitor indexing and search performance for relevant URLs.
Browser source inspectionLets you check hreflang tags in the page HTML.
Developer toolsHelps inspect rendered HTML and network responses.
XML sitemap validationHelps identify formatting and sitemap implementation problems.

No single tool replaces a complete audit. Combine crawling, source inspection, canonical checks, and manual review to understand the actual configuration.

Hreflang vs. Canonical Tags: What Is the Difference?

Hreflang and canonical tags are often confused because both can appear in the <head> section of a webpage. However, they solve different problems.

FeatureHreflangCanonical
Main purposeIdentifies alternate language or regional versionsIdentifies a preferred URL among duplicate or similar pages
Main useInternational SEODuplicate URL management
Typical implementationHTML, HTTP headers, or XML sitemapHTML link element or HTTP header
RelationshipConnects localized alternativesConsolidates canonical preference
Replaces the other?NoNo

A website may need both. For example, an international store can use canonical tags to identify the preferred URL for each localized page and hreflang annotations to connect the different language versions.

Hreflang Implementation Checklist

Before considering an implementation complete, review the following points:

  • Every localized page has the correct language and optional region code.
  • Each page includes a self-referencing hreflang annotation.
  • Alternate pages reference one another.
  • Hreflang destinations return the expected HTTP status.
  • Alternate URLs do not contain unnecessary redirects.
  • Canonical tags are consistent with the intended page structure.
  • Language and regional codes are valid.
  • The x-default value is used where a fallback page is appropriate.
  • Sitemap or HTML annotations are maintained consistently.
  • Changes are tested after implementation.

Frequently Asked Questions

Do hreflang tags improve rankings?

Hreflang tags help search engines understand language and regional alternatives. They can help the appropriate version appear for relevant users, but they are not a direct ranking boost or a guarantee of higher positions.

Are hreflang tags necessary for every website?

No. They are mainly useful for websites that have multiple language or regional versions of the same or equivalent content. A website serving one language and one market generally does not need them.

Can I use hreflang without translating every page?

You can use regional variations for content that is not fully translated, but each page should accurately reflect its declared language and intended audience. Hreflang itself does not translate content.

Should every hreflang page have a self-referencing tag?

Yes. Each page in an alternate-language group should include a reference to itself as well as the other relevant alternatives.

Can hreflang and canonical tags be used together?

Yes. They have different purposes and can work together. Each localized page should have a suitable canonical configuration, while hreflang connects its alternate language or regional versions.

Is x-default required?

No. It is optional and can be useful when a website has a general page or language-selection page for visitors who do not match the specified alternatives.

Final Thoughts

SEO hreflang tags help international websites communicate the relationship between localized pages. When implemented correctly, they give search engines useful information about language and regional targeting, making it easier to select an appropriate version for a searcher.

The most important implementation details are valid language codes, self-referencing annotations, reciprocal links, accessible destination URLs, and consistent canonical signals.

Treat hreflang as part of a wider international SEO process. Review the actual page content, test the implementation with a crawler, and monitor your localized URLs after making changes. A consistent setup is easier to maintain and less likely to develop technical errors as the website expands into new markets.

Leave a Comment

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