How to Use Hreflang Tags: A Step-by-Step Guide for Multilingual Sites

Hreflang tells Google which language version to show. Follow Google's documentation to plan, write, validate and maintain hreflang on your site.

Close-up of a desk globe with an orange and blue map of North America and the Atlantic Ocean, beside a second globe against a dark blurred background with warm lights.
Photo: Juliana Kozoski via Unsplash

Key Takeaways

Hreflang tags tell Google which language or regional version of a page to show each searcher. This guide follows Google's own documentation to plan, write, validate and maintain hreflang on a multilingual or multi-regional site.

  • Google accepts hreflang in HTML, HTTP headers or sitemaps.
  • The three methods are equivalent, so pick only one.
  • Every version must list itself and all other versions.
  • Links that do not point back to each other are ignored.
  • Use x-default as the fallback for unmatched languages.

What hreflang does and when you need it

A signal for localized versions

Google's guide to localized versions of a page says hreflang helps Search point users to the most appropriate version by language or region. Google may find alternate versions on its own, but it says explicit annotations are usually best.

Google also notes that it does not use hreflang or the HTML lang attribute to detect a page's language. It uses algorithms for that, so hreflang is about mapping versions, not labelling content.

Situations where Google recommends it

Google lists three common scenarios for indicating alternate pages:

  • The main content stays in one language and only the template, such as navigation, is translated.
  • The content has small regional variations in one language, such as English for the US, UK and Ireland.
  • The site is fully translated into several languages, such as German and English.

Google adds that localized pages only count as duplicates if the main content remains untranslated.

Hreflang and canonical tags

Regional pages in the same language can look like duplicates to site owners. Our guide to canonical tags explains how canonicalization works, so you can keep each localized page indexable while still signalling the right version.

Step 1: plan your URL structure

Give each language its own URL

Google's page on managing multi-regional sites recommends separate URLs for each language version. It advises against using cookies or browser settings to change the language on a single URL.

Choose a domain pattern

Google compares several URL structures, including a country-code domain like example.de, a subdomain like de.example.com or a subdirectory like example.com/de/. Country-code domains send a strong country signal, but Google notes they can only target a single country.

Google also treats some vanity country-code domains, such as .tv and .me, as generic domains.

Avoid automatic redirects and IP guessing

Google advises against automatically redirecting users to a language version based on guesses about their language. It also warns that IP location analysis is generally unreliable and that most, but not all, Google crawls originate from the US.

Instead, let users switch language with links, and use hreflang to guide Search.

Step 2: pick the right language and region codes

How a code is built

An hreflang value has a language code in ISO 639-1 format, optionally followed by a region code in ISO 3166-1 Alpha 2 format. For example, en-GB means English content for users in the UK.

Google says only codes from those standards are supported, so a value like es-419 is not.

Never use a country code alone

Google warns that the first code always stands for the language and that it does not derive language from a country. A page for Belgium tagged be would point at Belarusian, so use de-BE, nl-BE or fr-BE instead.

Scripts and letter case

Values are case-insensitive, although uppercase region codes follow ISO convention. For Chinese, Google derives the script from the region, or you can set it explicitly with zh-Hant or zh-Hans.

Step 3: choose one implementation method

HTML link elements

The most common method adds <link rel="alternate" hreflang="..." href="..."> elements to the page head. Each version carries one link per variant, including itself, and the set is identical on every version.

Google stresses that the elements must sit inside a well-formed head section, so check the rendered HTML with a validator.

HTTP headers

For non-HTML files such as PDFs, Google supports a Link header in the HTTP response. It lists every version with rel="alternate" and its hreflang value, and the header is identical for every version.

XML sitemaps

Large sites often prefer sitemaps, with an xhtml:link child for every variant under each URL entry. Google says the child elements do not count towards the sitemap URL limit.

Google calls the three methods equivalent and sees no Search benefit in using more than one, which would only add maintenance work.

Step 4: write complete, two-way annotations

Self-reference and full URLs

Each language version must list itself as well as every other version. Alternate URLs must be fully qualified, including https, and they do not need to be on the same domain.

Return links are mandatory

Google ignores the tags when two pages do not both point to each other. This stops another site from naming itself as an alternate version of your page.

Prioritise links to your main version

If a full set of two-way links is hard to maintain, Google says you can omit some languages on some pages. New language pages should still link both ways with the original or dominant language version first.

Step 5: add catch-all and fallback pages

A generic page per language

When you have several regional versions in one language, Google suggests a catch-all page for that language. For example, a site with en-IE, en-CA and en-AU pages can add a generic en page for everyone else.

The x-default value

The x-default value tells Google which page to show when no listed language or region matches the searcher. It suits language selectors and home pages that would otherwise redirect automatically.

A worked example

Take a site with an English page at example.com/en/, a German page at example.com/de/ and a language selector at example.com/. Each of the three pages would carry the same three annotations: hreflang="en" for the English URL, hreflang="de" for the German URL and hreflang="x-default" for the selector.

A Spanish speaker matches neither language, so Google can show the selector page instead. The same set of three lines appears on every page in the group, which is what makes the annotations reciprocal.

When a fallback is optional

Google presents x-default as something to consider rather than a requirement. If your main language page already works as a sensible default for everyone, you can point x-default at it or leave it out.

Step 6: validate, monitor and maintain

Check indexing in Search Console

After launch, inspect a sample of localized URLs to confirm Google can crawl and index each one. Our guide to Google Search Console covers URL inspection and the page indexing report.

Keep crawlers able to reach every version

Google can only read hreflang on pages it can crawl. Make sure no language folder is blocked by mistake, as our explainer on robots.txt rules shows.

Audit after every content change

Adding or removing a language version changes the annotations on every related page in that group, not just the new one. GrowthCentr's advice is to generate hreflang from one source of truth, such as your CMS or sitemap build, rather than editing pages by hand.

Conclusion

Hreflang works when every version uses valid language codes, lists itself and all alternates with full URLs, and receives a return link from each of them. Choose one method, add x-default for unmatched users and automate the annotations so they stay complete as your site grows.

Frequently Asked Questions

What is an hreflang tag?

It is an annotation that tells Google which URLs are language or regional versions of the same content, so Search can show the right one.

Does Google use hreflang to detect language?

No, Google says it detects a page's language with algorithms and uses hreflang only to understand localized variations.

Can I use a country code on its own?

No, the first code must be a language code, so use a value such as fr-BE rather than be for Belgium.

Should hreflang pages link to themselves?

Yes, each version must list itself as well as every other language or regional version.

What happens if return links are missing?

Google ignores hreflang annotations between two pages that do not both point to each other.

What is x-default used for?

It marks the fallback page for users whose language or region does not match any listed version, such as a language selector.

Can I use HTML tags and a sitemap together?

You can, but Google says there is no Search benefit and it makes the setup harder to manage.

Sources: Google Search Central, Tell Google about localized versions of your page; Managing multi-regional and multilingual sites. Figures checked 4 December 2026. This guide is general information, not legal advice.