The hreflang attribute is an HTML tag that tells Google the language and, if necessary, the country targeted by a page, as well as the other versions of that same page. It allows the version best suited to each user to be displayed in search results—for example, showing the fr-BE page to a French-speaking Belgian—and prevents your language versions from competing with one another.
Without hreflang, Google chooses which version to show on its own, and it often gets it wrong when two pages share the same language, such as a French version and a Swiss version. The visitor then ends up with the wrong currency or the wrong catalog.
This guide covers syntax, language and country codes, the three implementation methods, settings for Shopify, WordPress, and Webflow, and the errors most frequently encountered during audits.
What is the hreflang tag?
Technically, hreflang is an attribute of the link rel="alternate" element, hence the shorthand "hreflang tag." It declares that a page has equivalents in other languages or for other countries.
Google groups these variants into a set and then displays the one in its results that best matches the user's language and location.
What is the purpose of hreflang in SEO?
Hreflang has three concrete effects on an international site:
- The right page for the right audience : a Canadian user sees the fr-CA version with prices in Canadian dollars rather than the French version.
- Less confusion between similar pages : to English pages for the UK and the US are almost identical. Hreflang tells Google that these are intentional variants, not duplicate content that needs to be filtered.
- A better conversion rate:the right currency, the right shipping terms, and the right language reduce bounce rates.
Hreflang does not boost a page's ranking: it affects which version is displayed, not the position. A weak page remains weak, regardless of its annotations.
When does your site need it?
Hreflang is useful in three situations: a site translated into several languages, a site that adapts the same language for several countries (fr-FR, fr-BE, fr-CH), or a mix of both. This is the typical case for an e-commerce site that sells in several countries with different prices and catalogs.
A site available in only one language, for a single market, does not need it. A page that only exists in one language should not point to fictional versions either.
How do you write an hreflang tag?
Basic syntax
Here is the set to place in the head of a page available in French for France, French for Belgium, and English:

This same block must appear identically on each of the three pages. Each page therefore cites itself, then cites all its variants.
URLs must be absolute, including the protocol: "https://www.exemple.com/en/" and never "/en/".
Language and country codes: the correct formats
The language code is mandatory and follows the ISO 639-1 standard. The country code is optional, follows the ISO 3166-1 Alpha 2 standard, and is placed after the language, separated by a hyphen. A country code alone will not work.
According to Google's documentation, reserved codes like EU, UN, or UK have no effect: geographic targeting is simply lost.
The x-default value
The x-default value designates the fallback page for users whose language or country does not match any declared variant. This is often the international homepage, a country selector, or the English version.
It is not mandatory, but Google recommends adding it, especially for language selection pages and homepages that redirect the user. Without it, Google chooses the version to show to uncovered markets itself.
{{audit-primary="/cta"}}
HTML tags, HTTP headers, or sitemaps: which method should you choose?
Google accepts three methods for declaring variants. They are of equal value in its eyes: the choice depends on your CMS, the volume of pages, and who maintains the site.
A single method is sufficient. Combining them increases the risk of inconsistency, for example, an up-to-date sitemap and tags that remain on the old URL. If you use the sitemap, our guide on the XML sitemap details its structure and submission.
Hreflang on Shopify, WordPress, and Webflow
On most CMS platforms, you don't write tags by hand. The work involves verifying what the tool generates and fixing its blind spots.
- Shopify : hreflang tags are created automatically for every international domain or subfolder configured in Shopify Markets. They can be disabled in store preferences, but you would then need to add them to the theme yourself.
- WordPress : the CMS does not handle multilingual content natively. Translation plugins like WPML, Polylang, or Weglot add the annotations, provided that each piece of content is correctly linked to its translations.
- Webflow : the Localization feature generates tags in the head of each page and in the automatic sitemap. As of April 2025, the Settings panel allows you to disable this generation or define a custom base URL.
Common point of caution: a translation that isn't linked to its original breaks the entire set. A check after adding any new language or market remains essential.
Rules to follow: reciprocity, self-referencing, and canonicals
Reciprocity and self-referencing
Hreflang links must be bidirectional : if the French page cites the German version, the German version must cite the French page. Google requires this to prevent a third-party site from declaring itself a variant of your pages without your consent.
Each page must also cite itself within its annotation block. On a large site, Google may tolerate some missing links, but new languages must at the very least be reciprocally linked to the original version.
Hreflang and canonical tags
Hreflang and canonical tags do not serve the same purpose. The canonical tag designates the reference version among identical pages, while hreflang links equivalent pages in different languages. Each language version must therefore have a canonical tag pointing to itself.
A classic mistake is to have the canonical tag of the English page point to the French page. Google then interprets the English page as a duplicate to be ignored, and the hreflang annotation loses its purpose. The URLs cited in the hreflang must all be canonical, indexable, and return a 200 status code.
Beware of automatic redirects based on language or IP
Automatically redirecting users based on their IP address or browser language is tempting, but Google explicitly advises against it. Googlebot primarily crawls from the United States: an IP-based redirect can prevent it from seeing your other versions.
It is better to keep the user on the requested page and offer the appropriate version via a banner or a country selector. Hreflang handles the rest in the search results.
The 7 most common hreflang errors
Here are the issues most frequently encountered during an technical SEO audit international site audit:
- Missing return link : page A cites B, but B does not cite A. The annotation may be ignored.
- Invalid language or country codes : en-UK, fr_FR, a country without a language, or a reserved code like EU.
- Hreflang pointing to a non-canonical URL : the annotation cites a URL with parameters or a URL whose canonical tag points elsewhere.
- Hreflang pointing to an error or redirected page : after a site redesign, the annotations still point to old URLs that return 404 or 301 status codes.
- Relative URLs : "/en/" instead of the full URL with protocol and domain.
- Multiple URLs for the same language : two pages declared as fr-FR in the same set; Google doesn't know which one to choose.
- Annotations on untranslated pages : the "English" version actually displays French text, which contradicts the language Google detects in the content.
This last point is often underestimated. Google determines a page's language based on its visible content, regardless of the lang attribute or the URL: no annotation can compensate for a missing translation.
{{rdv-primary="/cta"}}
How to check your hreflang tags?
The "International Targeting" report in Search Console was removed on September 22, 2022. Google confirmed at that time that it continues to use hreflang. Verification is now done using other tools:
- A full site crawl : a crawl with Screaming Frog extracts all annotations and flags missing return links, invalid codes, non-canonical URLs, and error targets.
- The Search Console URL Inspection tool : it shows the canonical page selected by Google for a given variant and reveals cases where Google groups two versions you intended to be distinct.
- Performance reports by country : a fr-BE page receiving most of its clicks from France indicates an annotation that is not being properly accounted for.
- Server log analysis : a log analysis shows whether Googlebot is actually crawling each version, which helps identify versions blocked by a redirect.
This check must be repeated after every market launch and every redesign. Regarding URL structure, subfolders, subdomains, and country-specific domains are all valid for your SEO architecture: Google only advises against using URL parameters (?loc=de).
How datashake supports your international SEO
datashake supports 60% of its clients in their international expansion. The agency is among the few French agencies selected for the Google Partners International Growth Program.
On the technical side, the team SEO and GEO team at datashake audits the entire hreflang implementation: URL structure, consistency between hreflang and canonical tags, redirects, sitemaps, and actual coverage by Googlebot. The goal is to ensure each market receives the correct page, both in Google and in AI answer engines.
FAQ
Is hreflang a ranking factor?
No. Hreflang does not boost a page's ranking; it tells Google which variant to display to which user. Its impact is measured by the version displayed per country and by the conversion rate, not by position.
Are hreflang tags necessary for a single-language site?
No, if the site targets only one market. Hreflang is only useful when at least two versions of the same page exist, in two languages or for two countries. On a monolingual site, these annotations serve no purpose and only introduce a potential source of errors.
What is the difference between hreflang and the lang attribute?
The lang attribute, placed on the html tag, declares the page's language for browsers and screen readers. Google does not use it to determine a page's language; instead, it analyzes the visible content. Hreflang, on the other hand, links the page to its equivalents in other languages or countries.
Why does Google ignore my hreflang tags?
The most common causes are a missing return link, an invalid language or country code, or a cited URL that is not canonical or returns an error. A full site crawl can identify these in minutes. Finally, hreflang remains a hint rather than a directive: Google may display a different version if it deems it more relevant.
Can hreflang be used across different domains?
Yes. Variants do not need to be on the same domain: example.fr can point to example.de, provided the links are reciprocal. This is the standard configuration for brands that use a country-specific domain strategy.
%20(1).png)
.png)
.png)
.png)