All Articles
SEO

How to Implement Hreflang Tags: Step-by-Step 2026 Guide

February 17, 2026  ·  9 min read

Why Hreflang Matters for International Websites

Hreflang is an HTML attribute that tells search engines which language and regional version of a page to show to users in different locations. Without it, Google may show your English page to French users, your German page to Austrian users looking for Swiss-German content, or, in the worst case, flag your localized pages as duplicate content and deindex them entirely.

For businesses operating across multiple European markets, correct hreflang implementation is not optional. It directly impacts which version of your pages appears in local search results, which in turn affects click-through rates, user experience, and ultimately conversion. A 2025 Ahrefs study found that websites with correct hreflang implementation saw 47% higher organic traffic from non-primary markets compared to sites with incorrect or missing hreflang tags.

The Three Implementation Methods

There are three ways to implement hreflang: HTML link elements in the page head, HTTP headers, and XML sitemaps. Each has advantages depending on your technical setup.

HTML link elements are the most common method. You add a set of link tags in the head of every page, one for each language/region variant including a self-referencing tag. This is straightforward for small sites but becomes unwieldy when you have dozens of language variants.

HTTP headers are used for non-HTML resources (PDFs, for example) and can be useful when you cannot modify the HTML head. They work identically to the HTML method but are specified in the server response headers.

XML sitemaps are the best approach for large sites with many language variants. You specify hreflang annotations in your sitemap using the xhtml:link element within each URL entry. This keeps the hreflang logic centralized, makes it easier to audit, and does not add weight to your HTML pages. For sites with 5+ language variants, we strongly recommend the sitemap approach.

Here is how the three methods compare at a glance:

MethodWhere it livesBest forWatch out for
HTML link elementsIn the head of every pageSmall sites under a dozen locale variantsEvery page needs the full tag set, so it gets unwieldy once you have many variants
HTTP headersIn the server response headersNon-HTML files like PDFs, or pages where you cannot edit the headConfigured on the server rather than the page, which makes it harder to audit
XML sitemapIn the xhtml:link element inside each sitemap URL entryLarge sites with five or more language variantsNeeds a sitemap generator that knows which pages are translations of each other

Mistake 1: Missing Return Links

The most common hreflang error is missing return links. Hreflang annotations must be bidirectional: if Page A declares Page B as its French variant, Page B must also declare Page A as its English variant. If either direction is missing, Google ignores both annotations.

This sounds simple but becomes complex at scale. If you have 10 language variants, every page needs 10 hreflang tags (including self-referencing), and all 10 pages must have matching annotations. That is 100 annotations that must be perfectly synchronized across 10 separate pages. One missing or mismatched annotation can break the entire chain.

The solution is to generate hreflang annotations programmatically from a single source of truth, typically a database or CMS that knows which pages are translations of each other. Never manually maintain hreflang tags across localized pages.

Mistakes 2-3: Wrong Language Codes and Missing x-default

Mistake 2: Wrong language and region codes. Hreflang uses ISO 639-1 language codes and optionally ISO 3166-1 Alpha 2 region codes. Common errors include using "uk" for Ukrainian (it should be "uk" for the language, not "ua" for the country), confusing "zh-Hans" (simplified Chinese) with "zh-CN" (Chinese for China), and using three-letter language codes (which are not supported).

For European implementations, pay attention to regional variants: "pt" (Portuguese) is different from "pt-BR" (Brazilian Portuguese). "en-GB" and "en-US" are distinct variants. If you serve different content to Austrian ("de-AT") and German ("de-DE") users, you need separate hreflang annotations for each.

Mistake 3: Missing x-default tag. The x-default hreflang value tells search engines which page to show when no other hreflang variant matches the user's language or region. Without it, Google makes its own choice, which may not be what you want. Always include an x-default that points to your language selector page or your English-language version as a fallback.

Mistakes 4-5: Canonical Conflicts and Non-200 Pages

Mistake 4: Canonical and hreflang conflicts. If a page has a canonical tag pointing to a different URL than what the hreflang annotation specifies, Google will follow the canonical and ignore the hreflang. Every page referenced in your hreflang annotations must have a self-referencing canonical tag. If your French page at /fr/product/ has a canonical pointing to /en/product/, your hreflang annotation for the French page will be silently ignored.

Mistake 5: Hreflang pointing to non-200 pages. Every URL in your hreflang annotations must return a 200 HTTP status code. If any URL returns a 301 redirect, a 404, or a 500 error, Google will ignore the hreflang annotation for that entire page set. This commonly happens during site migrations or URL structure changes when old URLs are redirected but hreflang annotations are not updated simultaneously.

To catch these issues, implement automated monitoring. Google Search Console reports hreflang errors, but with a delay. Tools like Screaming Frog, Sitebulb, or Ahrefs can crawl your site and validate hreflang annotations in real-time, catching errors before they impact your rankings.

How to Implement Hreflang: A Step-by-Step Checklist

If you only take one workflow away from this guide, take this one. Run these six steps in order whenever you add a new locale or audit an existing set.

  1. List every locale variant of the page and confirm each one returns a 200 status. A variant that 301s or 404s will take the whole set down with it.
  2. Pick one declaration method per URL (head link tags, an HTTP header, or a sitemap entry) and do not mix two methods on the same page.
  3. Add a self-referencing tag first, so the page points to itself, then add one tag for each sibling locale.
  4. Check reciprocity. If the English page points to the French one, the French page has to point back. When the return link is missing, Google drops both annotations.
  5. Add an x-default that points to your language selector or your primary version, so users in regions you have not mapped still land somewhere sensible.
  6. Confirm each canonical points to itself, not to another locale, then validate the full set in Search Console and a crawler before you ship.

The order matters. Most broken implementations we audit fail at step 4 (a missing return link) or step 6 (a canonical quietly overriding the hreflang annotation), and both are invisible until traffic to a secondary market starts sliding.

A Worked Multi-Locale Example: One URL, Three Languages

Theory is easier to absorb with a concrete case. Suppose you run an e-commerce site with product pages in English (international), Italian, and Spanish. Your product URL structure looks like this:

  • https://example.com/products/widget/ (en, x-default)
  • https://example.com/it/products/widget/ (it)
  • https://example.com/es/products/widget/ (es)

Each of those three URLs must carry a complete, reciprocal set of hreflang annotations. Here is what the head of the English page needs to contain:

<link rel="alternate" hreflang="en"
      href="https://example.com/products/widget/" />
<link rel="alternate" hreflang="it"
      href="https://example.com/it/products/widget/" />
<link rel="alternate" hreflang="es"
      href="https://example.com/es/products/widget/" />
<link rel="alternate" hreflang="x-default"
      href="https://example.com/products/widget/" />

The Italian page (/it/products/widget/) must contain the exact same four tags, with the same four URLs, unchanged. So does the Spanish page. All three pages carry the full set; the only thing that differs between them is their own canonical tag, which each page points to itself. If you drop even one tag on one page, Google silently discards the entire annotation cluster for that product.

A few things worth noting in this example. The x-default and the English page share the same URL here, which is the most common pattern for sites without a dedicated language-selector page. If you do have a selector page at /products/, point x-default there instead. Also note that the language codes are bare ISO 639-1 values (en, it, es) rather than region-qualified codes. Adding a region qualifier (en-GB, es-MX) is only warranted when you serve genuinely different content to users in different countries speaking the same language; otherwise the bare code is more inclusive and covers more user geographies.

How to Validate Your Hreflang Implementation

Getting the tags onto the page is only half the job. You need to confirm that Google is reading them correctly and that no silent breakages have crept in. There are three practical ways to do this.

Search Console International Targeting report. Under Search Console, go to Legacy tools and reports, then International Targeting. The Language tab shows detected hreflang values across your site and flags any language codes that Search Console cannot parse. The report has a lag of several days, so treat it as a periodic audit rather than a deployment check. One important note: the absence of errors here does not confirm that Google is acting on the tags, only that it can read them.

A dedicated hreflang crawler. Tools such as Screaming Frog (Configuration > Spider > Crawl linked XML sitemaps and hreflang), Sitebulb, and JetOctopus can follow hreflang relationships across your entire locale set in one pass. They surface broken reciprocal links, mismatched URLs between paired pages, and tags pointing to redirects or 404s, all in a single export. For any site with more than two or three locale variants, a crawl is the only realistic way to catch systematic errors.

A quick curl check for a specific URL. When you want to verify a single page immediately after deployment, you can inspect the raw response headers and HTML head without a full crawl:

curl -s "https://example.com/products/widget/" | grep -i hreflang

That prints every hreflang link element in the page source. Check that the count matches the number of locale variants you expect (including the x-default), and confirm each URL is absolute rather than relative. Relative URLs in hreflang annotations are not supported and cause the tag to be silently ignored.

Hreflang FAQ

How do I implement hreflang tags correctly?

Declare hreflang in one place per page (head link elements, HTTP headers, or XML sitemap entries) and keep that method consistent. Every variant references every other variant, including itself, and each reference has to be reciprocal. Mixing methods on one URL and omitting the self-reference are the two breakages we see most.

Where should hreflang tags go: HTML head, HTTP header, or sitemap?

HTML head suits most sites under a dozen locale variants. HTTP headers fit non-HTML files like PDFs or cases where you cannot edit the head. The sitemap method wins at scale, where you have hundreds of pages per locale and want to keep page weight down. Never declare the same URL's hreflang in two locations.

What does x-default mean?

x-default is the fallback hreflang value. It tells search engines which page to serve when no language or region matches the user, and it usually points at a language selector or the primary English version. Leave it out and Google guesses, which often means the wrong locale shows up in unmapped regions.

Why is my hreflang not working?

Five usual suspects: a non-reciprocal link, a wrong ISO code (en-UK instead of en-GB), a missing self-reference, two declaration methods on one URL, or hreflang pointing at a URL that 404s or redirects. Check the International Targeting report in Search Console and run a crawler like Screaming Frog before you conclude that Google is ignoring the tags.

Does hreflang help with duplicate content across country sites?

Yes, but only in a specific way. Hreflang does not suppress duplicate content signals the way a canonical does. What it does is tell Google that two similar pages are intended for different audiences, so they should be treated as separate, targeted results rather than competing copies. If your content is substantially identical across locales and the only differences are currency or date formats, you still need the annotations, but you should also be honest with yourself about whether those pages genuinely serve different user needs. Thin differentiation with hreflang is better than nothing, but investing in real localization will always produce stronger signals.

How many hreflang tags can one page have?

There is no documented hard limit from Google. In practice, sites with 50 or more active locale variants use XML sitemaps rather than head link elements precisely because placing 50 or more link tags in every page head is unwieldy and adds measurable weight to HTML responses. If you are using the head method and the tag count approaches 20 or more, consider migrating to the sitemap method. The sitemap approach scales to several hundred locale variants without any per-page overhead.

Do I need hreflang if my pages are in the same language but target different countries?

Yes. If you serve meaningfully different content to, say, British and Australian English speakers (different pricing, different product availability, different legal terms), hreflang with region qualifiers (en-GB and en-AU) tells Google to show each variant to the right audience. Without it, Google will pick whichever version it considers most authoritative and serve it globally, ignoring the regional targeting. The threshold for "meaningfully different" matters: pages that differ only in the spelling of "colour" probably do not warrant the overhead; pages with different prices, shipping options, or legal disclaimers do.

Part of our complete guide: International SEO →

This article is part of our comprehensive knowledge hub on international seo. Read the full guide for a complete strategic framework.

Related Articles

Related Case Studies

From the Little Marketing Book

Browse the full Little Marketing Book →

From the Startup Stack

Browse the full Startup Stack →

Related reading

Related reading

Related reading

Ready to put these strategies into action?

Our team helps companies implement the frameworks and strategies covered in this article.

Get in Touch