Hreflang localization

Last updated 17 June 2026 4 min

Hreflang is an HTML attribute that tells search engines which language and regional version of a page to show to which audience. It's how Google decides whether to show example.com/en-au/, example.com/en-gb/, or example.com/en-us/ to a user searching in Australia, the UK, or the US.

What hreflang solves

Without hreflang, search engines have to guess which version of a multilingual or multi-regional site is most appropriate. Common results of getting it wrong:

  • An Australian user lands on the US version with USD prices.
  • Two near-identical English pages (UK vs. US) get treated as duplicates and compete with each other in rankings, when these pages actually target completely different audiences.

Hreflang resolves these issues by explicitly mapping every page variant to its target language and (optionally) region.

Declaring hreflang

Hreflang values follow the format language-region:

  • Language code — ISO 639-1 (en, fr, de, es, zh).
  • Region code (optional) — ISO 3166-1 Alpha-2 (au, gb, us, fr, de).

Examples: - en — English, no specific region. - en-au — English for Australia. - es-mx — Spanish for Mexico. - zh-hant — Traditional Chinese (uses ISO 15924 script code). - x-default — fallback for users whose language/region doesn't match any other version.

There are multiple methods for implementing hreflang, but the simplest, implementing it in the HTML <head>, looks like this:

<link rel="alternate" hreflang="en-au" href="https://example.com/en-au/">
<link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/">
<link rel="alternate" hreflang="en-us" href="https://example.com/en-us/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">

This specifies the appropriate pages for Australian, UK, and US visitors, as well as a fallback for users outside these countries.

The three rules of valid hreflang

1. Bidirectional confirmation

Every page must list all language/region versions, including itself. If page A points to page B as an alternate, page B must point back to page A. Missing return tags is the most common hreflang error and causes Google to ignore the entire annotation set.

2. Self-reference

Each page must include a hreflang tag pointing to itself, with its own language/region.

3. Absolute URLs only

Hreflang doesn't support relative URLs. Always use the full https://... URL.

x-default

The x-default value tells search engines which version to show when no other variant matches the user's language or region. Common uses:

  • A global homepage with a country/language selector.
  • The English (international) version of a site.
  • A redirect router that detects user location.

Common patterns

Same language, different regions

For English-speaking markets:

<link rel="alternate" hreflang="en-au" href=".../en-au/">
<link rel="alternate" hreflang="en-gb" href=".../en-gb/">
<link rel="alternate" hreflang="en-us" href=".../en-us/">
<link rel="alternate" hreflang="en" href=".../en/">
<link rel="alternate" hreflang="x-default" href=".../">

Same region, different languages

For Switzerland (German, French, Italian):

<link rel="alternate" hreflang="de-ch" href=".../de-ch/">
<link rel="alternate" hreflang="fr-ch" href=".../fr-ch/">
<link rel="alternate" hreflang="it-ch" href=".../it-ch/">

Common mistakes

  • Missing return tags — page A → B, but B doesn't reference A. This invalidates the entire cluster.
  • Incorrect codes — using en-uk (incorrect) instead of en-gb (correct), or cn instead of zh.
  • Pointing to noindex or redirected URLs — alternates must be live, indexable pages.
  • Mismatched URLs between hreflang and canonical URLs. These must match.
  • Mixing methods — declaring some hreflang in HTML and some in the sitemap. Pick one source of truth.
  • Using hreflang for content that isn't translated — if all "language versions" are actually the same English page, hreflang doesn't help and may cause Google to consolidate them anyway.

Disclaimer: All information contained herein is for informational purposes only. It is not advice or instructional.