Hreflang tags tell search engines which language and regional version of a page to show users based on their location and language preferences. Without hreflang, Google may display the wrong country or language variant in search results, or flag regional pages as duplicate content.
When You Need Hreflang
Hreflang is required when your site has:
- Translated content - The same page available in multiple languages (English, Spanish, German).
- Regional variations - The same language content tailored for different countries (English US vs English UK vs English Australia).
- Combined language and region - Content that varies by both language and location (French for France vs French for Canada).
If your site serves a single language to a single country, you do not need hreflang.
Hreflang Syntax
Hreflang can be implemented in three ways: HTML <link> tags, HTTP headers, or XML sitemaps.
HTML Link Tags (Most Common)
<link rel="alternate" hreflang="en-us" href="https://example.com/page" />
<link rel="alternate" hreflang="en-gb" href="https://example.co.uk/page" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/page" />
Place these in the <head> section of every page in the cluster.
XML Sitemap Implementation
<url>
<loc>https://example.com/page</loc>
<xhtml:link rel="alternate" hreflang="en-us" href="https://example.com/page" />
<xhtml:link rel="alternate" hreflang="en-gb" href="https://example.co.uk/page" />
<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/page" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/page" />
</url>
The sitemap approach is better for large sites because it avoids adding multiple <link> tags to every page's HTML.
Language and Region Codes
Hreflang uses ISO 639-1 language codes and optional ISO 3166-1 Alpha-2 country codes:
en- English (any region)en-us- English for United Statesen-gb- English for United Kingdomfr- French (any region)fr-ca- French for Canadazh-hans- Simplified Chinese
The language code is required. The region code is optional but necessary when you have the same language targeting different countries.
The x-default Tag
The x-default value specifies the fallback page for users who do not match any of the defined language/region combinations. Typically, this points to your primary English page or a language selector page:
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Every hreflang cluster should include an x-default entry.
Critical Implementation Rules
Bidirectional Confirmation
Every hreflang annotation must be reciprocal. If page A declares page B as its Spanish alternate, page B must also declare page A as its English alternate. Missing return tags cause Google to ignore the entire annotation.
Self-Referencing Tags
Each page must include a hreflang tag pointing to itself. A page at example.com/page must include hreflang="en-us" href="https://example.com/page" among its hreflang annotations.
Canonical Consistency
Each page's canonical tag must point to itself (self-referencing), not to another language version. A French page should canonicalize to itself, not to the English version.
Common Mistakes
- Missing return tags - The number one implementation error. Every page must reference all variants, including itself.
- Wrong language codes - Using
ukfor Ukrainian (correct:uk) vs usingukfor United Kingdom (correct:en-gb). Country codes and language codes are different standards. - Pointing hreflang to non-200 pages - All hreflang URLs must return a 200 status code. Redirects, 404s, and noindex pages break the annotation.
- Mixing implementation methods - Choose one method (HTML, HTTP headers, or sitemap) and use it consistently. Mixing methods creates conflicts.
Validation
Google Search Console reports hreflang errors under "International Targeting" (legacy) and in the Page Indexing report. Check for "no return tag" and "unknown language code" errors.
Screaming Frog crawls all hreflang annotations and validates bidirectional confirmation, language codes, and URL consistency in its "Hreflang" tab.
Ahrefs Site Audit includes an hreflang validation module that flags missing return tags, incorrect codes, and broken URLs across the full annotation set.
Test changes on a small page cluster before rolling hreflang annotations out site-wide.