In beta, with limited placesOpen to everyone in Q1 2027

↑↓ to move · Enter to open · Esc to close

Crawling and indexing

What is hreflang and what is it for?

hreflang is the attribute a page uses to tell search engines which other URLs are versions of the same content in another language or for another region, with a code such as es, en-GB or x-default. hreflang does not translate or redirect anyone: it exists so the search engine shows each person the version in their language.

Written by
Reviewed by
Published 7 min read
Takeaway:

Key takeaways

  • hreflang ties together the versions of a page in different languages or regions so the search engine shows each person theirs.
  • Each version links to itself and to all the others: if two pages do not point at each other, Google ignores the tags.
  • The code starts with the language and can add the region (es, en-GB); a country code on its own is not valid.
  • Google does not use hreflang to work out what language a page is in: it detects that by itself, by reading the text.
  • Each version declares a canonical in its own language, not the main version's.

hreflang only matters if your store has more than one version of its pages: in English and Spanish, or in English for the United States and for the United Kingdom. If that is you, the problem it solves is concrete: that someone searching in Spanish lands on the Spanish product page and not the English one, and that near-identical regional versions do not compete with each other as duplicate content. It is not a translation tag or a redirect: it is a list of equivalents that the search engine can use or ignore, depending on how well it is done.

How it works

Google accepts three ways to declare the versions of a page and treats them as equivalent: <link> elements in the HTML <head>, HTTP headers (useful for files that are not HTML, such as a PDF) or entries in the XML sitemap. You can use all three at once, but you gain nothing in Search and maintaining three implementations is harder than maintaining one.⁠[1]Google Search Central. Tell Google about localized versions of your page

The rules that make it work are few and strict:⁠[1]Google Search Central. Tell Google about localized versions of your page

  • Each version lists itself and all the others. If two pages do not point at each other, Google ignores the tags. The reason is security: it stops anyone on another site from declaring themselves an alternate version of one of your pages.
  • The code starts with the language, in ISO 639-1 format, and can add the region in ISO 3166-1 alpha-2 format: es, es-ES, en-GB. A country code on its own is not valid, because Google does not infer the language from the country.
  • x-default is the version for everyone else: the one offered to people searching in a language that is not on the list. Google designed it for language selector pages.
  • URLs are fully qualified, with https://, not relative. They can be on different domains.

There are two things hreflang does not do, and it helps to keep them in mind. The first: Google uses neither hreflang nor the HTML lang attribute to work out what language a page is in; it detects that with its own algorithms, by reading the text.⁠[1]Google Search Central. Tell Google about localized versions of your page The second: hreflang does not move anyone from one page to another. Google asks for a separate URL for each language, instead of cookies or browser settings, and for no automatic redirects from one language to another. Remember too that Googlebot usually crawls from the United States: a store that redirects by IP address may never let it see the Spanish version.⁠[2]Google Search Central. Managing multi-regional and multilingual sites What Google does recommend is visible links to the other versions, so people can switch.⁠[2]Google Search Central. Managing multi-regional and multilingual sites

It crosses with the canonical in two ways. Google prefers as canonicals the URLs that belong to a hreflang group, and asks that, if you use hreflang, each page declares a canonical in its own language, or in the best substitute if there is none in that language.⁠[3]Google Search Central. How to specify a canonical URL with rel="canonical" and other methods That makes sense: to Google, translated versions are only duplicates if the main content is still untranslated.⁠[1]Google Search Central. Tell Google about localized versions of your page

Bing also recommends hreflang to signal language and region, and adds a warning that matters to stores: near-identical regional pages create duplicate content. Its advice is to localize with real changes, such as terminology, examples, regulations or product data, and not to create several pages in the same language that serve the same purpose.⁠[4]Microsoft, Bing Webmaster blog (Fabrice Canel and Krishna Madhavan, December 19, 2025). Does Duplicate Content Hurt SEO and AI Search Visibility?

On a store

A fictional example: a mountain gear store sells in the United States and in Spanish-speaking markets, with one folder per version. This is the <head> of a backpack's product page in its US version:

<head>
  <link rel="canonical" href="https://store.example/us/trek-25-backpack" />
  <link rel="alternate" hreflang="en-US" href="https://store.example/us/trek-25-backpack" />
  <link rel="alternate" hreflang="es" href="https://store.example/es/mochila-trek-25" />
  <link
    rel="alternate"
    hreflang="x-default"
    href="https://store.example/us/trek-25-backpack"
  />
</head>

The Spanish version repeats the three alternate lines exactly the same and changes only its canonical, which points to itself. That is the pair that has to line up: the same alternates on every version, and a canonical of its own on each.

If your store is on Shopify, you do not have to write any of this by hand. Shopify adds the hreflang tags automatically through content_for_header, which the theme prints in the <head> of layout/theme.liquid. A single-country market produces a code with a region, such as en-us, and a broader one produces just the language, such as fr; the tags update when you change a market's domains or languages. If your theme or an app already writes its own tags, Shopify recommends turning the automatic ones off under Online Store, Preferences, so there is only one source.⁠[5]Shopify Dev Docs. Use hreflang tags in your theme

Warning:

What gets confused

That hreflang tells Google what language the page is in. It does not: Google detects the language by reading the content and uses neither hreflang nor the lang attribute for that.⁠[1]Google Search Central. Tell Google about localized versions of your page A product page marked es with its description still in English remains, for Google, an English page. hreflang only relates versions that already exist, so translate first and link after.

How to check it

  1. Open the page source of a product page (Ctrl+U in Chrome) in each language and search for hreflang. Each version has to list itself and all the others, with the same URLs.⁠[1]Google Search Central. Tell Google about localized versions of your page
  2. Review the codes: language first, region after it if there is one, and never a country alone. The most common errors Google cites are missing return links and misspelled language or region codes.⁠[1]Google Search Central. Tell Google about localized versions of your page
  3. Open every URL on the list and confirm it loads the version it says it does, without redirecting you to another one based on your location.⁠[2]Google Search Central. Managing multi-regional and multilingual sites
  4. Look for rel="canonical" on each version: it has to point to a page in its own language, normally itself.⁠[3]Google Search Central. How to specify a canonical URL with rel="canonical" and other methods
  5. On Shopify, count the sources. If you see the tags repeated, the theme or an app is writing them in addition to Shopify, and one of the two has to be turned off.⁠[5]Shopify Dev Docs. Use hreflang tags in your theme

The canonical and hreflang get confused because both go in a <link> in the <head> and both talk about several URLs. They solve opposite problems. The canonical picks one URL among copies of the same content, for example the same product page opened with a campaign parameter. hreflang relates different pages that say the same thing in another language, and asks the search engine to keep them all, each for its own audience. That is why an English version with a canonical pointing to the Spanish one is a mistake: it tells Google the English page is a copy and not to index it separately, exactly the opposite of what hreflang asks for.⁠[3]Google Search Central. How to specify a canonical URL with rel="canonical" and other methods

To keep going, the reading path for this topic puts the rest of the terms in order, from how a URL is discovered to its indexing, and internal linking explains how crawlers reach each version.

Synonyms

English
hreflang tag, hreflang annotation
Español
etiqueta hreflang, anotación hreflang

Sources

  1. [1] Google Search Central. Tell Google about localized versions of your page. Accessed . ↑ ↑ ↑ ↑ ↑ ↑ ↑
  2. [2] Google Search Central. Managing multi-regional and multilingual sites. Accessed . ↑ ↑ ↑
  3. [3] Google Search Central. How to specify a canonical URL with rel="canonical" and other methods. Accessed . ↑ ↑ ↑
  4. [4] Microsoft, Bing Webmaster blog (Fabrice Canel and Krishna Madhavan, December 19, 2025). Does Duplicate Content Hurt SEO and AI Search Visibility?. Accessed . ↑
  5. [5] Shopify Dev Docs. Use hreflang tags in your theme. Accessed . ↑ ↑

Change history

  • First English version.

This definition is published under CC BY 4.0. Reuse this definition freely, crediting Clione with a link to this page.

Make your catalog easy for bots to read

Clione fills every product page with what bots read best: the JSON-LD graph with its structured data, the meta description and the FAQs. You review and press Push; then we check your live store so it all stays published.