A hreflang tag is an HTML attribute — <link rel="alternate" hreflang="en-US" href="..." /> — that tells Google which language and regional version of a page to serve to each user. It does not change rankings; it changes which URL gets shown in the search result. Hreflang is used by Google and Yandex only. Bing does not use it and instead reads <meta http-equiv="content-language">.
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" /> — language code (ISO 639-1) optionally combined with a region code (ISO 3166-1 alpha-2).<head>, XML sitemap (xhtml:link), or HTTP Link: response header. Pick one — mixing methods causes conflicts.hreflang="x-default" for the fallback URL shown when no language/region matches the user.content-language meta or server signals instead.Hreflang values follow strict standards. Wrong codes are silently ignored by Google, which is why many implementations "look right" but do nothing. Language uses ISO 639-1 (two letters). Region uses ISO 3166-1 alpha-2 (two letters). The two are joined by a hyphen, not an underscore.
| What you want to target | Correct code | Common mistake |
|---|---|---|
| English (any region) | en | eng, en_US |
| American English | en-US | en-us works, en_US does not |
| British English | en-GB | en-UK (UK is not a valid ISO code) |
| Brazilian Portuguese | pt-BR | pt-BZ, br |
| European Portuguese | pt-PT or pt | por |
| Mexican Spanish | es-MX | es-MEX |
| Simplified Chinese (Mainland) | zh-CN | cn, chi |
| Traditional Chinese (Taiwan) | zh-TW | tw |
| Default / unmatched users | x-default | default, en-default |
Region without language is invalid. hreflang="US" on its own is silently dropped — you must always specify the language.
You have three places to declare hreflang. Pick the one that fits your stack and stick to it.
<head> (most common)Every variant page lists every variant — including itself — inside <head>:
<!-- Place on every variant page (en-US, en-GB, es-MX, fr-FR ...) -->
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/" />
<link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/" />
<link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />Best for large sites — declare all variants once per URL group:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/en-us/</loc>
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" />
<xhtml:link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/" />
<xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
<url>
<loc>https://example.com/es-mx/</loc>
<xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" />
<xhtml:link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/" />
<xhtml:link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>
</urlset>Link: HeaderRequired for non-HTML files like PDFs:
Link: <https://example.com/en-us/whitepaper.pdf>; rel="alternate"; hreflang="en-US",
<https://example.com/es-mx/whitepaper.pdf>; rel="alternate"; hreflang="es-MX",
<https://example.com/whitepaper.pdf>; rel="alternate"; hreflang="x-default"Hreflang and the canonical tag interact in a way that breaks many international sites. The rule: each variant must self-canonicalize. The French page's canonical points to the French URL, not the English one.
<!-- CORRECT: on /fr-fr/page -->
<link rel="canonical" href="https://example.com/fr-fr/page" />
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/page" />
<link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/page" />
<!-- WRONG: on /fr-fr/page -->
<link rel="canonical" href="https://example.com/en-us/page" />
<link rel="alternate" hreflang="fr-FR" href="https://example.com/fr-fr/page" />In the wrong example, the canonical tells Google "the English page is the master" — so Google drops the French URL from its index, and hreflang has nothing left to swap in.
en-UK instead of en-GB, pt-BZ instead of pt-BR, underscores instead of hyphens. Google silently ignores invalid codes./fr-fr/ redirects to /fr/, your hreflang must point at /fr/ directly. Redirect chains and 404s break the cluster.hreflang="x-default"is the URL Google shows when no other variant matches the user's language or region. It is not the "default language" — it is the "none-of-the-above" fallback.
example.com/) that auto-detects language or shows a country selector.en or en-US.x-default, users outside your declared regions get a guessed result.Hreflang fails silently. You need to actively check it.
curl -I https://example.com/fr-fr/ — confirm 200 OK, not a redirect chain.&gl=fr&hl=fr URL parameters or a VPN to verify Google is returning the right variant.No. Hreflang only applies when you have two or more language or regional variants of the same content.
No. Hreflang does not boost rankings. It controls which already-ranking URL gets shown to a given user. The total visibility of your content does not change.
en without a region?Yes. hreflang="en" targets all English speakers regardless of country. Use language-only codes when content does not vary by region. Mix language-only and language-region codes carefully — Google picks the most specific match.
Google follows the redirect once but the cluster is considered weaker. Always point hreflang at the final 200-OK URL.
No. Bing reads <meta http-equiv="content-language" content="fr-FR"> and the Content-Language HTTP header, plus geotargeting in Bing Webmaster Tools. Yandex uses hreflang.
Yes. Cross-domain hreflang is supported — example.com can declare example.fr as its French variant. Reciprocity still applies: example.fr must link back.
There is no hard cap. Sites with hundreds of locales typically use the XML sitemap method because the HTML head approach gets unwieldy past ~10 variants.
If the URL and content differ (e.g. /us/ in USD vs /ca/ in CAD, both English), yes — use en-US and en-CA. If only the price widget changes via JavaScript on the same URL, hreflang does not apply.
Hreflang is a routing instruction, not a ranking lever. Get the codes right, make every variant link reciprocally to every other variant including itself, give each variant its own self-canonical, and add an x-default. Validate in Search Console's International Targeting report and Screaming Frog. Most international SEO problems come down to one of the six mistakes above — fix those and Google will serve the right page to the right user.