FREE TOOL · NO SIGNUP TO PREVIEW

Generate Hreflang Tags for Multi-Region Sites

Tell Google which language and country each page is for. Add your URL and variants to get valid hreflang markup — HTML, HTTP header, or XML sitemap, with x-default included.

Hreflang inputs

2 rows
-
-
Example output — enter your URL and variants above to generate your own hreflang tags.
HTML <head>5 tags

Resolved hreflang relationships

hreflanghref
en-UShttps://example.com/products
en-GBhttps://example.com/uk/products
fr-FRhttps://example.com/fr/produits
de-DEhttps://example.com/de/produkte
x-defaulthttps://example.com/products

Copy-paste HTML <head> markup

<link rel="alternate" hreflang="en-US" href="https://example.com/products" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/products" />
<link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/produits" />
<link rel="alternate" hreflang="de-DE" href="https://example.com/de/produkte" />
<link rel="alternate" hreflang="x-default" href="https://example.com/products" />

Paste these inside the <head> of every listed page. Each variant must link back to all the others (bidirectional), including itself.

The Complete Guide

Hreflang Tags Explained: How to Target the Right Language and Region

5 MIN READ

Understand with AI

Discuss with your preferred AI assistant

#1
Most common error

Missing return (non-reciprocal) tags are the top hreflang issue flagged in Google Search Console.

lang-REGION
Subtag order

Language always comes first and is required; the uppercase region code is optional.

3
Implementation methods

Declare hreflang via HTML link tags, HTTP headers, or an XML sitemap — pick one and stay consistent.

If you run a website that serves more than one country or language, hreflang tags are how you tell Google which version of a page to show to which audience. Get them right and a German searcher lands on your German page and a US searcher on your dollar-priced page. Get them wrong and Google shows the wrong version, splits your ranking signals, or ignores your localized content entirely.

This guide explains what hreflang is, exactly how the tags work, the most common mistakes that break them, and how to implement them across HTML, HTTP headers, and XML sitemaps.

What Are Hreflang Tags?

Hreflang is an HTML attribute (and its equivalent in HTTP headers and sitemaps) that tells search engines the language and optional region a page targets. It was introduced by Google in 2011 to solve a specific problem: when you have near-identical pages for different markets, search engines need a way to know they are intentional alternates rather than duplicate content.

A single hreflang annotation looks like this:

  • rel="alternate" — signals this is an alternate version of the current page.
  • hreflang="en-GB" — the language (and optional region) the alternate targets.
  • href="https://example.com/uk/" — the absolute URL of that alternate.

The value combines an ISO 639-1 language code (like en, fr, or de) with an optional ISO 3166-1 Alpha-2 region code (like US, GB, or FR), written as language-REGION. The language comes first and is mandatory; the region is optional and uppercase by convention.

How Hreflang Works: The Three Golden Rules

1. Annotations must be reciprocal (bidirectional)

If your English page points to your French page, the French page must point back to the English page. Hreflang is a confirmation between pages — if the link is one-way, Google ignores it. Every page in a language set should list the full set of alternates, including a self-referencing tag pointing to itself.

2. Use absolute URLs and one canonical signal per cluster

Always use fully-qualified URLs (starting with https://). Relative URLs are not supported. Each page should also have a self-referencing canonical tag — never point a canonical at a different-language version, or you will tell Google to drop the localized page.

3. Always add x-default

The x-default value tells Google which page to show when none of the listed language-region pairs match the user. It is typically your language selector, global homepage, or most generic English page. While technically optional, x-default is strongly recommended for any multi-region setup.

The Three Ways to Implement Hreflang

You can declare hreflang in three places. Pick one method per site and apply it consistently:

MethodWhere it goesBest for
HTML link tagsThe <head> of each pageMost sites; easiest to audit
HTTP Link headerServer response headersNon-HTML files like PDFs
XML sitemapA sitemap with xhtml:link entriesLarge sites; keeps page weight down

For most teams, HTML tags are the simplest to implement and verify. Large catalogs with thousands of localized URLs often prefer the sitemap method because it centralizes the annotations and avoids bloating every page's markup.

Common Hreflang Mistakes That Break Everything

  • Wrong codes — using en-UK instead of the correct en-GB, or a language code that does not exist. The region must be a valid ISO 3166-1 Alpha-2 country code.
  • Missing return tags — non-reciprocal links are the single most common error in Google Search Console's hreflang report.
  • Relative or non-canonical URLs — only absolute, indexable, self-canonical URLs should appear.
  • Region without language — you cannot target a country alone. hreflang="US" is invalid; use en-US.
  • Duplicate values — two entries with the same hreflang value confuse search engines and one will be ignored.
  • No x-default — leaving users in unlisted regions without a fallback page.

Do Hreflang Tags Affect Rankings?

Hreflang is not a ranking factor on its own. It does not make a page rank higher. What it does is ensure the correct localized page surfaces for each audience, which improves click-through rate, reduces bounce, and consolidates the authority of your language variants instead of letting them compete as duplicates. The SEO benefit is indirect but real: the right page, in front of the right user, in the right language.

Use the generator above to produce valid, reciprocal hreflang markup in seconds, then validate it in Google Search Console's International Targeting report once it is live.

Expert Tips

Always add a self-referencing tag

Each page must include an hreflang tag pointing to itself, alongside tags for every alternate. Forgetting the self-reference is a silent cause of ignored annotations.

Validate after you ship

Once live, check Google Search Console’s International Targeting report for missing return tags and unknown codes. Hreflang errors fail quietly, so audit rather than assume.

Frequently Asked Questions

What is the difference between hreflang and canonical tags?

A canonical tag tells search engines the single preferred URL among duplicates, while hreflang tells them which language or region version to serve. They work together: each localized page should self-canonicalize and then use hreflang to point to its alternates. Never set a canonical to a different-language page.

Is x-default required?

It is technically optional but strongly recommended. The x-default value defines the fallback page for users whose language or region does not match any listed variant — usually a global homepage or language selector. Without it, Google guesses, which can send users to the wrong version.

Can I target a country without specifying a language?

No. The language subtag is mandatory and must come first; the region subtag is optional. A value like "US" alone is invalid — you must write "en-US" or "es-US". You can, however, target a language without a region, such as "fr" for all French speakers regardless of country.

How do I check if my hreflang tags are working?

Use Google Search Console's International Targeting report, which flags missing return tags and unknown language codes. You can also crawl the site with an SEO crawler that audits hreflang reciprocity, or manually verify that every page in a cluster lists the full set of alternates plus a self-referencing tag.

Related guides

Related tools