top of page

Hreflang Tags: International SEO Implementation Guide

Feb 4
6 min read

If your website targets users in multiple countries or languages, you need to tell Google which version to show to which audience. Without that signal, Google guesses — and it often guesses wrong. Hreflang is the attribute that solves this. It is not a directive Google must follow, it is a strong hint. But implemented correctly, it consistently steers the right content to the right users.

This guide covers everything you need: what hreflang is, when to use it, how to implement it across three methods, and how to validate it without leaving loose ends.

⠀

What Hreflang Is (and What It Is Not)

⠀

Hreflang is an HTML attribute you add to your pages to indicate the language and, optionally, the geographic region each page targets. Google reads it when deciding which version of your content to surface in a specific search locale. It is important to understand that hreflang is a signal, not a directive — Google may still choose a different URL if other signals (links, server location, user behavior) strongly contradict your hreflang setup.

Hreflang does not handle different topics. If you have a page about summer shoes for the UK market and a completely different page about winter boots for the US market, hreflang is not the right tool. It is designed for the same content in different languages or regional variants of the same language.

⠀

When to Use Hreflang

⠀

Use hreflang in two clear scenarios:

  • Different languages: You have an English page and a French translation of the same content. Hreflang signals Google to show /en/ to English speakers and /fr/ to French speakers.

  • Same language, different regions: You have en-US and en-GB versions with different pricing, spelling, or references. Without hreflang, Google may show the wrong regional variant.

⠀

Do not add hreflang just because you have a multilingual navigation menu. If the underlying pages are identical or near-identical, you create duplicate content problems without solving anything. Each hreflang variant should have meaningfully different content tailored to its locale.

⠀

Hreflang Attribute Syntax

⠀

The attribute follows a strict format using ISO 639-1 language codes and ISO 3166-1 alpha-2 country codes:

<link rel="alternate" hreflang="en" href="https://example.com/page/" /> <link rel="alternate" hreflang="en-US" href="https://example.com/us/page/" /> <link rel="alternate" hreflang="en-GB" href="https://example.com/gb/page/" /> <link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/page/" />

⠀

Language codes are lowercase (en, fr, de). Country codes are uppercase (US, GB, DE). Combining them requires a hyphen: en-US, fr-CA. Getting either code wrong causes Google to ignore the tag entirely.

x-default is a special value that designates the fallback page — the version Google should show when no other hreflang variant matches the user's locale. Typically this points to your main page or a language selector page. It is optional but strongly recommended.

⠀

Three Ways to Implement Hreflang

⠀

1. HTML Head Tags

⠀

Place hreflang link elements in the <head> section of every page in the set. This is the most common method and works for most CMS platforms.

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

⠀

Every page in the set must include all variants, including a self-referencing tag pointing to itself. This is not optional — missing self-references is one of the most common hreflang implementation errors.

2. HTTP Header (for Non-HTML Files)

⠀

For PDFs and other non-HTML files, you cannot add tags to the head. Use HTTP response headers instead:

Link: <https://example.com/doc.pdf>; rel="alternate"; hreflang="en", <https://example.com/de/doc.pdf>; rel="alternate"; hreflang="de"

⠀

This requires server-side configuration and is typically set in .htaccess, Nginx config, or your hosting platform's header management.

3. XML Sitemap

⠀

For large sites, maintaining hreflang in every HTML file is impractical. The XML sitemap method centralizes all hreflang declarations in one place:

<url> <loc>https://example.com/page/</loc> <xhtml:link rel="alternate" hreflang="en" href="https://example.com/page/"/> <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/page/"/> </url> <url> <loc>https://example.com/de/page/</loc> <xhtml:link rel="alternate" hreflang="en" href="https://example.com/page/"/> <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/page/"/> </url>

⠀

The sitemap must declare the xmlns:xhtml namespace in the root <urlset> element. Every URL in the hreflang set must appear as its own <url> entry with the full set of <xhtml:link> tags.

⠀

The Self-Referencing Requirement

⠀

Every page in a hreflang set must reference itself. If your German page does not include a tag pointing to itself with hreflang="de", Google treats the entire cluster as improperly configured. This rule applies regardless of which implementation method you choose.

At Blakfy, when we audit international sites, missing self-references are the most frequently overlooked issue — and they silently break the entire hreflang setup without throwing any visible errors.

⠀

Common Mistakes That Break Hreflang

⠀

Missing return tags are the most common problem. If your English page references the German page but the German page does not reference back to the English page, Google ignores both tags. Every relationship must be declared bidirectionally.

Wrong language or country codes are the second most common error. EN instead of en, uk instead of gb (the UK's ISO code is GB, not UK) — these render the tag unreadable to Google. Always verify codes against the official ISO lists.

Using hreflang for different topics is a conceptual mistake. Hreflang is for alternate versions of the same content. Two pages on different subjects that happen to target different countries should not be linked with hreflang.

Hreflang on noindexed pages does not work. If a page is blocked by noindex or robots.txt, Google cannot process its hreflang annotations. Ensure all pages in a hreflang set are crawlable and indexable.

Mismatched canonical and hreflang tags cause confusion. If your German page has a canonical pointing to the English page, Google sees a contradiction and may ignore hreflang entirely. Each localized page should have a self-referencing canonical alongside its hreflang tags.

⠀

Hreflang and Canonical Tags

⠀

Canonical and hreflang serve different purposes and must work together consistently. The canonical tag tells Google which URL is the preferred version among duplicates. Hreflang tells Google which language/region variant to serve to which audience.

The correct setup: each localized page has a self-referencing canonical (<link rel="canonical" href="https://example.com/de/page/" /> on the German page) and carries the full set of hreflang tags. Never set the canonical of a localized page to the default language page — that tells Google the localized page is a duplicate and should be consolidated, which directly contradicts hreflang's purpose.

⠀

Validating Your Implementation

⠀

Google Search Console International Targeting Report

⠀

In GSC, navigate to Legacy Tools and Reports > International Targeting. The Language tab shows whether Google has detected your hreflang tags and any errors it found. Common reported errors include missing return tags and unrecognized language codes.

Note: This report is available only for sites that have implemented hreflang. If you have never used hreflang, the report will show no data.

Hreflang Testing Tools

⠀

Several third-party tools crawl your site and validate hreflang clusters:

  • Ahrefs Site Audit flags hreflang errors including missing return tags, self-reference issues, and conflicting canonicals.

  • Screaming Frog has a dedicated hreflang tab that maps every alternate relationship and highlights broken links within hreflang clusters.

  • hreflang.org validator lets you test individual URLs for free.

⠀

After any implementation change, wait 1-2 weeks before evaluating results in GSC. Googlebot does not crawl all pages simultaneously, and it takes time for hreflang clusters to be fully processed.

⠀

⠀

FAQ

⠀

Does hreflang affect rankings?

Not directly. Hreflang does not boost rankings — it controls which URL ranks in which locale. The right page appearing in the right country's search results can improve click-through rates and reduce bounce rates, which indirectly benefits performance.

Do I need hreflang if I only target one language?

If you only target one language and one country, no. Hreflang is for multilingual or multi-regional sites. A single-market English site does not need it.

What happens if I implement hreflang incorrectly?

At worst, Google ignores the tags and continues serving pages based on other signals. You will not receive a manual penalty for incorrect hreflang. However, incorrect implementation means users may still see the wrong regional version, which was the problem you were trying to solve.

Can I use hreflang with subdirectories, subdomains, and separate domains?

Yes. Hreflang works across all URL structures: example.com/fr/, fr.example.com, and example.fr are all supported. The implementation method does not change — only the URLs in the tags differ.

bottom of page