Hreflang Tags Explained: Syntax, Rules and Common Mistakes
What hreflang tags are, why multilingual sites need them, the exact syntax, x-default, how they work with canonical tags, and the mistakes that make Google ignore them.
Updated 24 September 2026 · 5 min read
Your site is translated and every language loads. Yet Google keeps sending French visitors to your English pages, or indexes only one language. Usually the cause is a missing or broken hreflang.
This guide covers what hreflang does, its rules, and the mistakes that make Google ignore it. To test your own site as you read, use our free multilingual SEO checker.
What hreflang is
hreflang is an attribute on a <link> tag that tells search engines: "this page also exists in these other languages, at these URLs". Google then shows each searcher the version in their language, and treats the versions as one group rather than competing pages.
A typical block, placed in the <head> of every language version:
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/pricing/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/pricing/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing/" />
Hreflang is a strong signal, not a command. Get one rule wrong and it is ignored.
Why it matters
Without hreflang, three things tend to happen:
- The wrong language shows up in search. A German visitor lands on your Spanish page, does not understand it and leaves.
- Versions get clustered. Google may group near-identical pages and show only one of them, so your other languages lose visibility.
- New markets stay invisible. Competitors with a clean setup take the rankings you translated for.
The rules
Reciprocity
If the English page lists the French page, the French page must list the English page back. Otherwise Google discards the pairing. The easy fix is to output the same block on every version.
Absolute URLs
Always use the full URL with protocol and host: https://example.com/fr/, never /fr/. It must match your live URLs exactly, including https and www.
Self-reference
Each page includes itself in the block: the French page lists hreflang="fr" pointing to its own URL.
Valid ISO codes
The language is an ISO 639-1 code (en, fr, de), optionally followed by a hyphen and an ISO 3166-1 region (en-GB, pt-BR, es-MX). A region on its own is not valid. These are the mistakes we see most:
| Wrong | Correct |
|---|---|
en-UK | en-GB |
jp | ja |
cn | zh or zh-CN |
kr | ko |
dk | da |
gr | el |
cz | cs |
ua | uk (Ukrainian, not the UK) |
en_US | en-US (hyphen, not underscore) |
An invalid code means that single tag is dropped.
x-default
x-default tells Google which page to show when none of your languages match the searcher. It is not strictly required, but leaving it out lets Google guess. Add it to the block on every language version, just like the other entries.
Three ways to implement hreflang
- In the HTML
<head>. The most common method and the easiest to inspect. - In the XML sitemap. Each
<url>lists its alternates withxhtml:linkelements. Useful for large sites because everything lives in one file. - In the HTTP
Linkheader. Meant for non-HTML files such as PDFs, where there is no<head>.
Pick one method. Mixing them is allowed, but if they disagree the signals conflict.
Hreflang and canonical tags
This is where most multilingual sites break. The canonical says "this is the preferred URL for this page". Hreflang says "these other URLs are the same page in other languages". They answer different questions.
The rule: every language version has a canonical that points to itself.
<!-- On https://example.com/fr/pricing/ -->
<link rel="canonical" href="https://example.com/fr/pricing/" />
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/pricing/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing/" />
If the French page's canonical points to the English page, Google treats the French page as a duplicate, follows the canonical and ignores the hreflang. Translations are not duplicate content, so a cross-language canonical protects nothing.
Don't forget html lang
The <html lang="fr"> attribute declares the language of the page itself. It does not replace hreflang, but it should match the code you use for that page in the block. A French page that says lang="en" sends mixed signals.
Typical mistakes
- Return links missing between some language pairs.
- Relative URLs, or URLs that redirect or return 404.
- A canonical pointing to the original language on every translation.
- Hreflang on a site where every language shares one URL (JavaScript or
?lang=switching). There is nothing real to point to.
How to check your hreflang
Open a translated page, view the source (Ctrl+U or Cmd+Option+U) and search for hreflang and canonical. Then open one of the listed URLs and confirm it links back.
That gets slow beyond a few pages. The quicker route is to run a page through our free multilingual SEO checker. It validates hreflang in the head and HTTP header (codes, absolute URLs, self-reference, x-default, duplicates), compares it with html lang, checks the canonical, and visits up to six translated versions to confirm they load, link back and declare their language. For everything beyond hreflang, follow our multilingual SEO audit checklist.
How Lantis handles hreflang
Writing hreflang by hand on a 50-page site in four languages means hundreds of tags to keep in sync. Lantis serves each language on its own URL (a subfolder like /fr/) and adds hreflang for every language plus x-default, the correct html lang and a self-referencing canonical automatically, on Framer, Webflow, WordPress, Shopify or any site with one line of code. Translation is done by AI, with a visual editor and a glossary.
It costs from €3/month per language (€2.50 from two languages, €2 from ten), and the first 100 translations are free with no card. On Framer, install the Lantis plugin. See the step-by-step guides for Framer and Webflow.
Frequently asked questions
Is hreflang a ranking factor?
Not directly. It decides which language version Google shows each searcher, which improves clicks in every market and stops versions being clustered together.
Do I need x-default?
It is strongly recommended. Without it, Google has to guess what to show people whose language you do not cover. Point it to your main language or a language selector page.
Should I use en-GB or just en?
Use en if you have one English version for everyone. Add regions like en-GB and en-US only when you have separate versions for each country, such as different prices or spelling.
Also available in Français · Deutsch · Italiano · Português · हिन्दी · Русский · 日本語 · 한국어 · Türkçe · Bahasa Indonesia · العربية