The essentials
- Definition: hreflang is an HTML attribute that connects a page to its equivalents in other languages or countries, so Google shows each user the right version.
- Syntax: <link rel="alternate" hreflang="fr-be" href="https://example.com/be/">, with an ISO 639-1 language code and, optionally, an ISO 3166-1 alpha-2 country code.
- The key rule: every page must list every version, including itself, and every version must point back to the others (reciprocity).
- x-default: the version served when no language matches, often a selection page or the English version.
The hreflang attribute tells search engines that a page exists in several language or regional versions, and which one matches each language-country combination. Without it, Google may show the French page to a Belgian or Quebecois user, or treat two Spanish versions (Spain, Mexico) as duplicate content. It doesn't change ranking; it chooses which version to display.
Syntax and accepted codes
Each declaration takes the form <link rel="alternate" hreflang="code" href="URL absolue">. The code combines a language (ISO 639-1, two letters) and, optionally, a region (ISO 3166-1 alpha-2, two letters). A region on its own is not accepted.
| Code | Meaning | Note |
|---|---|---|
| fr | French, all countries | Enough for a site with no regional variants |
| fr-fr, fr-be, fr-ca, fr-ch | French for France, Belgium, Canada, Switzerland | Useful if prices, currency or offers differ |
| en-gb, en-us | British and American English | Two versions with near-identical content: hreflang avoids the duplicate |
| x-default | The default version | Served to languages not covered; recommended on any multilingual site |
| be, eu, uk | Invalid on their own | A region with no language; "uk" isn't the ISO code for the United Kingdom either (gb) |
The three implementation methods
| Method | Where | Suited to |
|---|---|---|
| link tags in the head | Every HTML page | Smaller sites, CMSs with a multilingual plugin |
| HTTP Link headers | The server's response | Non-HTML files (PDFs) |
| XML sitemap with xhtml:link | A file sitemap | Large sites; avoids weighing the HTML down with dozens of tags |
Whichever method you use, the rule of reciprocity applies: if page A declares B as its German version, B must declare A as its French version. A one-way declaration is ignored. Every page must also declare itself. On a site in 4 languages, each page therefore carries 4 hreflang tags plus x-default.
Hreflang and canonical
The two signals coexist but don't replace each other. Each language version must have a self-referencing canonical tag : declaring the French version as canonical for the German one amounts to asking for the German version to be deindexed, which contradicts the hreflang. Likewise, a URL cited in an hreflang must return 200, be indexable, and not be redirected.
The most frequent mistakes
- No return link: the number one cause of ignored annotations; Search Console used to flag it in the old International Targeting report, and today it takes a crawler such as Screaming Frog to detect it.
- Invented codes: "en-uk", "fr-eu", "sp" for Spanish (the code is "es").
- Relative URLs or ones pointing to a redirected version.
- Hreflang to an untranslated page: declaring an Italian version that actually shows English content.
- Forgetting x-default on sites that redirect automatically by IP address: Googlebot crawls mostly from the United States and then sees only the American version.
- Automatic geolocation redirects with no way to switch version: they stop the other languages being crawled at all.
Hreflang is only necessary if several versions genuinely exist. A French site with a few English pages benefits from declaring it; a monolingual site doesn't need it. Checking it belongs to the international section of an complete SEO audit, alongside the response codes.
How GreenRed helps
Rather than juggling several tools, GreenRed's Site health module brings these metrics together in a single dashboard, compares them over time and tells you which actions come first. You can try it free, with no card, from the Pricing.
Frequently asked questions
Does hreflang improve ranking?
No. Hreflang doesn't lift a page; it tells Google which version to show for which language and country. Its benefit is indirect: less duplicate content between near-identical versions, and a better click-through and conversion rate because the user lands on the page in their own language and currency.
Do you need hreflang for a site only in French?
No, unless regional versions exist (France, Belgium, Switzerland, Canada) with different content or offers. A site in a single language with no variants has nothing to declare; adding hreflang="fr" alone brings no benefit.
What happens if hreflang isn't reciprocal?
Google ignores the annotation. If the French page declares a German version but the German page doesn't point back to the French one, neither association is kept. Full reciprocity, including each page's self-reference, is the condition for it to work at all.
What is the difference between hreflang and the canonical tag?
The canonical designates the reference version among duplicates and concentrates indexing on it. Hreflang connects equivalent versions that must all stay indexed, each for its own audience. Every language version must carry its own self-referencing canonical, never a canonical to another language.