Hreflang
Hreflang is an HTML attribute that tells search engines which language and region a page targets and lists its alternate versions, so users see the right one.
What is Hreflang?
Hreflang is an HTML attribute used with rel="alternate" links to tell search engines that a page has equivalent versions for other languages or regions, and which locale each version targets. Google uses it to show users the version in their language or country, for example the German page to searchers in Germany and the UK English page in Britain.
Google introduced hreflang support in 2011. It matters most for sites that have the same content in several languages, or the same language for several countries with differences like currency, spelling or regulation.
How it works
Each version of a page lists all versions, including itself, using language codes (ISO 639-1) and optional region codes (ISO 3166-1 Alpha 2):
<link rel="alternate" hreflang="en-us" href="https://example.com/us/">
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/">
<link rel="alternate" hreflang="de" href="https://example.com/de/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">
Rules that matter:
| Rule | Why |
|---|---|
| Return links | If A points to B, B must point back to A, or Google may ignore the pair |
| Self-reference | Each page includes itself in the set |
| Canonical URLs only | Point to indexable, canonical versions |
| Valid codes | “en-uk” is invalid; use “en-gb” |
Hreflang can be implemented in HTML <head>, HTTP headers (for PDFs) or XML sitemaps. See hreflang tags for implementation details.
Examples
- A security SaaS has US, UK and Australian English pages with different pricing and compliance references. Hreflang ensures Australians see the AU version.
- A DevTools company translates its docs into Japanese and links each English page to its Japanese counterpart.
- A site’s Spanish page outranks its Mexican Spanish page in Mexico. Adding
es-mxandes-esannotations fixes it.
Best practices
- Use hreflang only between genuinely equivalent pages.
- Generate annotations automatically from your CMS or sitemap to avoid manual errors.
- Include x-default for users outside your listed locales.
- Audit regularly with a crawler; broken return links are the most common problem.
- Keep the HTML
langattribute consistent with hreflang.
Common mistakes
- Pointing hreflang to redirected, noindexed or non-canonical URLs.
- Canonicalizing all language versions to one URL, which tells Google to ignore the others.
- Using region codes alone (“gb”) without a language.
Hreflang and AI search
AI assistants answer in the user’s language and often retrieve pages from search indexes. If Google or Bing serve the wrong locale, AI answers built on those results may cite your US page to a German buyer, with the wrong pricing or compliance details. Correct hreflang, consistent lang attributes and genuinely localized content reduce that risk and help each market’s version be the one retrieved.
Related terms
- Hreflang Tags
- Language Targeting
- Geo-Targeting
- Global SEO Strategy
- Canonical Tags
- International SERPs
Sources
- Tell Google about localized versions of your page, Google Search Central
- Managing multi-regional and multilingual sites, Google Search Central
- International SEO: the complete guide, Ahrefs
Frequently asked questions
Does Bing support hreflang?
Bing has historically relied more on other signals, such as the content-language meta tag, HTML lang attribute and location signals, and treats hreflang as a weak signal at most. Google and Yandex support hreflang. For Bing, keep clear language signals in your HTML and URL structure as well.
Is hreflang a ranking factor?
No. Hreflang does not make a page rank higher. It helps Google choose which of your equivalent pages to show for a user's language and location. Without it, the wrong version may appear, for example your US page ranking in the UK with dollar prices.
What is x-default in hreflang?
x-default specifies the page to show when no listed language or region matches the user, often a global English page or a language selector. It is optional but recommended for sites with several locales. Google uses it as the fallback page when a user's language or region does not match any of the versions you listed.