RankWiki

Technical SEO

Hreflang Tags

Hreflang tags are HTML link attributes that tell search engines which language or regional version of a page to show to users based on their language or location.

Also called
hreflang annotations
Applies to
multilingual and multi-regional websites
Commonly confused with
canonical tags

Key points

  • Hreflang tags must be reciprocal: each variant must link to all others, including itself.
  • Use valid ISO 639-1 language codes and optional ISO 3166-1 alpha-2 country codes.
  • Hreflang can be implemented in HTML <head>, XML sitemaps, or HTTP headers.
  • The x-default value provides a fallback for unspecified language or region combinations.
  • Search engines treat hreflang as a signal, not a directive, so it helps disambiguate but does not guarantee ranking behavior.

How it works

Hreflang tags are implemented using the rel="alternate" hreflang="x" attribute in the HTML <head>, in XML sitemaps via <xhtml:link> elements, or through HTTP headers for non-HTML resources. Each page in a language or regional cluster must include a link to every other variant, including itself. For example, a page targeting US English would include: <link rel="alternate" hreflang="en-US" href="https://example.com/us/" />. The hreflang value uses ISO 639-1 language codes and optionally ISO 3166-1 alpha-2 country codes separated by a hyphen. The special value x-default serves as a catch-all for users whose language or region is not explicitly targeted.

Reciprocity is essential: if page A links to page B, page B must link back to page A and all other variants, including its own self-reference. Without reciprocal links, search engines may ignore the annotations. Proper hreflang implementation requires careful attention to these linking constraints and valid code formatting.

Why it matters

For international SEO, hreflang tags help prevent mismatches where users see content in the wrong language or region, reducing bounce rates and improving user experience. They also clarify to search engines that language and regional variants are equivalent content, not duplicates, helping avoid duplicate content issues that could harm rankings. A sound multilingual seo strategy relies on correct hreflang to target the right audience. Without it, users from different regions might land on the same page, resulting in poor relevance. Common seo issues linked to hreflang include missing reciprocal links and invalid codes, which can cause variants to be ignored or misdirected.

Where it changes your decision

  • When launching a new language version of a site (e.g., adding French and German versions of an English site), hreflang tells search engines which version to show to users in France vs. Germany, preventing mismatches.
  • When a website has country-specific landing pages with the same language (e.g., /uk/ and /us/ with identical English but different regional offers), hreflang distinguishes these to avoid serving the wrong region and to correctly target local audiences.
  • When a site uses a mix of language and region targeting (e.g., en-US, en-GB, and Spanish for global), hreflang ensures that users see the most appropriate variant based on their location and language settings, improving relevance and user experience.

What it is not

  • Hreflang is not a ranking factor; it only helps disambiguate page variants. It does not directly improve rankings or pass link equity.
  • Hreflang is not the same as canonical tags (canonical seo). Canonical tags consolidate duplicate pages into a single preferred URL, while hreflang indicates equivalent pages in different languages or regions intended for different audiences.
  • Hreflang does not guarantee that the correct page will be shown in search results; search engines may override it based on user signals such as browser language or geographic location.
  • Hreflang is not for pages with unrelated content; the pages in a cluster must be equivalent translations or near-identical regional versions. Using hreflang for clearly different content can confuse search engines and reduce trust in your annotations.
Read next Meta Tags SEO Understanding hreflang tags builds on the broader topic of meta tags seo, which covers all on-page signals that communicate page purpose to search engines.

Questions people ask

What is hreflang tags?

Hreflang tags are HTML link attributes that tell search engines which language or regional version of a page to show to users based on their language or location. They are implemented using rel="alternate" hreflang="x" and can be placed in the HTML <head>, XML sitemaps, or HTTP headers. They help international sites target content to the correct audience.

How to implement hreflang tags?

To implement hreflang tags, first identify all language and regional versions of a page. Then add <link> tags in the <head> of each page referencing all variants, including itself. Alternatively, add xhtml:link elements in an XML sitemap. Ensure all links are reciprocal (each page links back to others) and use valid language and country codes. Include an x-default if needed. Validate using tools or search console.

How to fix hreflang tags with errors?

To fix hreflang errors, first identify broken reciprocal links (missing return links) and add them. Check for invalid or malformed language/country codes and correct them using ISO standards. Ensure self-referencing tags are present. Look for missing x-default if appropriate. Use Google Search Console's International Targeting report to find issues. Also verify that pages in the cluster are truly equivalent content.

Sources

  1. Google Search Central Primary Google guidance on localized versions and hreflang implementation.
  2. Google Search Central Explains locale-adaptive pages and how search engines understand language/region signals.
  3. Google Search Central Official guidance for multi-regional site setup and international targeting.
  4. Ahrefs Clear practitioner-focused explanation of hreflang syntax and implementation.
  5. Moz Widely cited SEO reference for hreflang basics and usage.