Hreflang tags for international SEO

Learn how hreflang tags help Google show the right language version of your pages, how to build them, and how Localize adds them automatically
Last updated on:
November 24, 2026
|
10
min read
Table of Contents
Book a Demo

After you translate and publish your website in different languages, what’s next?

We recommend you focus on SEO so search engines like Google and Yandex show the right language version of your site.

‍Hreflang tags help boost your international SEO to make your content discoverable all over the world.

What is an hreflang tag?

One of the best practices for getting search engines to index your content in other languages is to add hreflang tags to all of your pages.

Hreflang tags are bits of HTML code that tell a search engine what language your content is available in. For example, this bit of code would tell Google that there’s a French version of your web page available.

‍Example hreflang tag:

‍<link rel="alternate" href="https://www.example.com/fr" hreflang="fr-fr"/>

‍

Attribute Example Value Meaning
rel alternate Designates this page has a relationship with another page
href https://www.example.com/fr Specifies the URL where this alternate language page can be found
hreflang fr-fr Specifies the alternate language used on the page (French in this example)

‍

Once a search engine reads these tags, it uses them to decide which version of a page to show each searcher. Google and Yandex both support the hreflang attribute, but Bing doesn't read hreflang at all. Instead, Bing relies on the content-language meta tag, for example <meta http-equiv="content-language" content="fr-fr">, to figure out a page's language, so sites that want Bing traffic should add those meta tags as well.

Hreflang tags in search results

Example search results:

‍Search engines use your site’s hreflang attribute to organize the list of sites on the search engine results page (SERP). Here’s an example.

If you search Google for IKEA in the US, Google shows the IKEA homepage written in American English (EN-US).

In these examples, DE stands for Deutschland (Germany) and US stands for The United States. Hreflang values use standardized ISO 639-1 language codes and ISO 3166-1 country codes to mark a page's language or region.

Choosing an international site structure

Before you build hreflang tags, decide how your multilingual or multi-regional site will be structured, since this choice shapes which URLs you'll be linking together. There are four common patterns. A ccTLD (example.mx) uses a separate country-code domain for each market and sends a clear signal about country targeting, though it means buying and maintaining a new domain for every region. A subdomain (mx.example.com) keeps everything under one root domain while still letting you separate languages or regions, with a lighter setup burden than a ccTLD. A subdirectory (example.com/mx/) is the simplest to maintain, since every language version lives under the same domain and shares its existing authority. URL parameters (example.com/?lang=es-mx) are the easiest to set up technically, but this approach is not recommended because search engines often struggle to treat parameter-based pages as distinct, indexable versions, and the pages are hard to maintain as a site grows.

‍

Structure Country targeting Language targeting Maintenance and cost Authority
ccTLD (example.mx) Strong Medium Low (high cost, separate domain per market) Split per domain
Subdomain (mx.example.com) Medium Medium Medium Medium
Subdirectory (example.com/mx/) Medium Strong Strong (low cost, single domain) Shares main domain authority
URL parameters (example.com/?lang=es-mx) Weak Weak Low (hard to maintain, not recommended) Weak

‍

Whichever structure you pick, every language version needs its own URL, and hreflang tags must reference those full URLs, whether they sit across different domains, subdomains, or folders.

Benefits of hreflang tags

If you’ve invested in website translation, then you’ll want search engines to show the appropriate results to your international users. Hreflang tags help you tell Google and other engines about different versions of a page. This helps people in different countries find your content in their native language.

Here are the perks of hreflang implementation for your multilingual or multi-regional website. If your translated pages live in a CMS, read our guide to CMS localization to keep these SEO gains intact.

Better search results for non-English speakers

  • Many potential customers search in a language other than English. Showing them a page written in their own language makes the result more useful to them, so they're less likely to click straight back to the search results.

Positive impact on SEO and rankings

  • Hreflang tags can affect the rankings of multilingual variants of the same page. For example, if your English homepage ranks highly, you can use hreflang tags to help the Spanish, German, and French versions of the page have a similar ranking.

SEO and content quality gains

Avoiding duplicate content in search results

  • Let’s say you have US and UK versions of your homepage that are nearly identical, apart from localized spellings. Hreflang tags help search engines index both versions (EN-GB (British English) and EN-US (American English)). Without the tags, search engines like Google may view your multilingual web pages as duplicates and only index one version of the page. If a localization proxy serves your translated pages, each language version still needs its own URL and hreflang tags.

Keep in mind that hreflang is a signal to search engines, not a strict directive, so Google may still choose a different version if other signals conflict. It works alongside canonical tags and does not replace them. Each localized page should carry a self-referencing canonical tag pointing to its own URL, not to the original-language page, since canonicalizing a French page to the English one tells search engines to ignore the French page and its hreflang annotations.

Build an hreflang tag

To build an hreflang tag, look up the two-letter ISO 639-1 language code for your preferred language, and fill in the tag. There are three common ways to place these tags, and each suits a different situation.

HTML link tags in the <head> work best for standard web pages. This is the most common method, and it's the easiest to inspect since you can view the page source directly to check the tags.

HTTP headers are needed for non-HTML files like PDFs, which have no <head> section to hold a link tag. In this case, you set a Link header on the server so search engines can still read the language and region signals.

XML sitemaps are useful for large sites because all the annotations live in one file instead of being repeated on every page. Each URL entry in the sitemap lists its alternates using xhtml:link elements, which keeps things manageable as your site grows.

Pick one of these methods and use it consistently across the whole site.

Hreflang tags must be reciprocal. If your English page lists a German version as an alternate, the German page has to link back to the English one, or search engines may ignore the pair. Each page should also carry a tag pointing to itself, alongside the tags for every other language version.

If you have a generic page or language selector for visitors who don't match any of your versions, add an x-default tag so search engines know which page to show as a fallback: <link rel="alternate" hreflang="x-default" href="https://www.example.com/"/>. Whichever placement you pick, use it across the whole site, since mixing methods can send conflicting signals.

Example 1:

Let’s build a tag for the German version of the Localize website: https://de.localizejs.com.

Targeting German Speakers:

<link rel="alternate" hreflang="de" href="https://de.localizejs.com" />

Example 2:

Let’s say we wanted to target people in a specific region or country. To do this, we can use ISO 3166-1 alpha‑2 format in our hreflang tags. The region code pairs with the language code: a plain code like 'es' reaches Spanish speakers everywhere, while 'es-mx' narrows it to Spanish speakers in Mexico. For example:

Targeting English Speakers in Australia

<link rel="alternate" hreflang="en-au" href="https://au.example.com/features" />

Targeting English Speakers in England

<link rel="alternate" hreflang="en-gb" href="https://uk.example.com/features" />

Example 3:

Let's say a page is available in Spanish (Spain), French (France), and Portuguese (Portugal), with a fallback for visitors whose language doesn't match any version.

<link rel="alternate" hreflang="es-es" href="https://www.example.com/es/" />
<link rel="alternate" hreflang="fr-fr" href="https://www.example.com/fr/" />
<link rel="alternate" hreflang="pt-pt" href="https://www.example.com/pt/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />

This same four-tag block needs to appear on all three language versions of the page, giving each one its self-referencing tag along with the return tags search engines check for.

Common hreflang mistakes and how to fix them

Even careful teams run into a handful of recurring errors when setting up hreflang tags, so it helps to know what to check before you publish.

  • Missing return tags: Page A points to page B, but B doesn't point back to A, so search engines may ignore the pair. Add a reciprocal tag on both pages.
  • Wrong or made-up codes: Using something like 'en-uk' instead of 'en-gb', or 'jp' instead of 'ja', confuses search engines and breaks the pairing. Stick to standard ISO 639-1 language codes and ISO 3166-1 country codes.
  • Relative URLs: A relative path can point to the wrong location or fail to resolve at all. Always use a fully qualified URL that includes https://.
  • Canonical tags pointing to another language version: This sends a conflicting signal, since the canonical tag says one page is the master copy while the hreflang tag says another is a separate version. Use self-referencing canonicals on every page.
  • Missing self-referencing tag: Each page needs a tag pointing to itself in addition to tags for every alternate version, or search engines may misread the set. Double-check that every page in the group links to itself.
  • Mixing placement methods: Using HTML tags, HTTP headers, and an XML sitemap for different pages on the same site creates inconsistent signals. Pick one method and apply it across the whole site.

Easy hreflang tags with Localize

Constructing and managing hreflang tags is simple with Localize. Localize's translation software makes international SEO easy and automatic.

We’ll help you add hreflang tags to every page on your site automatically so your content is discoverable in any language. It’s as simple as filling in a brief form on your SEO Language Settings page:

‍

‍

Want hreflang tags on every translated page without editing your code? Start for free with Localize, add your languages, and fill in the SEO Language Settings form. Localize handles the rest.

‍

Author
Anton Noble specializes in bridging the gap between deep customer pain points and elegant technical solutions. As a Product Manager, he guides cross-functional development teams to turn real-world challenges into intuitive, high-impact software products.

Stay one step ahead

Stay in the loop! Sign up for our newsletter and get the latest news and product updates!

FAQs

What is an hreflang tag and why does it matter for multilingual websites?

An hreflang tag is a snippet of HTML code that tells search engines like Google which language a page is written in and which region it targets. Without these tags, search engines may treat near-identical language variants (such as EN-US and EN-GB) as duplicate content and only index one version, which means your international visitors may never see the right page.

Should I use a language code or a country code in my hreflang tags?

Use a language code (ISO 639-1) when you want to reach all speakers of a language regardless of location, and combine it with a country code (ISO 3166-1) when you need to target a specific region. For example, hreflang="de" targets German speakers globally, while hreflang="en-au" targets English speakers in Australia.

Can hreflang tags help my French or German pages rank as well as my English homepage?

Yes. When your English homepage ranks highly, properly implemented hreflang tags help signal to Google that your French, German, and Spanish variants are related, authoritative pages, which can support similar rankings for those versions rather than leaving them to compete against your own content.

How does Localize handle hreflang tag implementation automatically?

Localize adds hreflang tags to every page on your site automatically through its SEO Language Settings, so you fill in a brief form rather than hand-coding tags across hundreds of pages. This removes the need for developer involvement each time you add a new language or region.

What's the fastest way to get hreflang tags on a translated site without editing HTML manually?

If you want to avoid touching HTML on every page, a translation tool like Localize injects hreflang tags automatically as part of its international SEO setup. The alternative is adding tags manually to each page's <head> section or via an XML sitemap, which works but scales poorly as you add more languages.

Related Articles

Related Articles

Ready to translate your website and content faster?

Talk to an expert today to find out how you can translate your website in minutes, not months.