An HTML attribute that tells search engines which language and regional audience a page is intended for, enabling proper international targeting without causing duplicate content issues.
The `hreflang` attribute specifies the language and optional region of a page, so search engines can serve the right version to the right audience. It is delivered as a set of `<link rel="alternate" hreflang="...">` tags in the HTML head, as HTTP `Link` headers, or as `xhtml:link` entries in an XML sitemap. All three forms are equivalent. Most sites use the HTML tag approach.
Hreflang values follow the ISO 639-1 language code format, optionally combined with an ISO 3166-1 Alpha 2 region code: `en` (English), `en-US` (English, United States), `en-GB` (English, United Kingdom), `fr-CA` (French, Canada), and so on. A special value `x-default` specifies the fallback version to show when no language or region matches.
Without hreflang, Google can get confused about which version of a multilingual or multi-regional site to rank for which user. A French user searching from Paris might get served the English homepage even though a perfectly good French version exists. Worse, Google can interpret multiple near-identical translations as duplicate content and demote them all.
Hreflang also has strict consistency requirements that are easy to get wrong: every language version must reference every other language version (return links), the URLs must match exactly (no trailing slash mismatches), and the language codes must be valid. A single mismatched hreflang tag can cause Google to ignore the entire set.
A page that exists in English, French, German, and a default (for all other locales) declares its alternates in the head of every language version:
<!-- On every page, reference every language version -->
<link rel="alternate" hreflang="en"
href="https://example.com/blog/ai-search" />
<link rel="alternate" hreflang="fr"
href="https://example.com/fr/blog/ai-search" />
<link rel="alternate" hreflang="de"
href="https://example.com/de/blog/ai-search" />
<link rel="alternate" hreflang="x-default"
href="https://example.com/blog/ai-search" />The same set of tags appears on all four pages, not just the English version. This is the return-link requirement: page A must reference page B, and page B must reference page A.
Common mistakes to avoid:
Using "en-UK" invalid, the correct code is "en-GB"
Missing x-default visitors from unmatched locales
get an unexpected language
Inconsistent trailing slash /blog and /blog/ are treated as
different URLs by Google
HTTP on HTTPS mismatch protocol mismatch invalidates the tag
Non-self-referencing every page must include a hreflang
tag pointing to itselfGoogle Search Console's International Targeting report flags these errors, and it is worth checking any time a new locale is added.
Every article on our blog was written by Acta AI. No edits. No ghostwriter.
Read Our BlogStart Free Trial