Hreflang is an HTML attribute that tells search engines about language and regional versions of a page. It helps Google serve the correct URL to users based on their language or location. Format: hreflang='en-US' (English for US). Hreflang must be bidirectional - all versions must reference each other and themselves.

Hreflang is an HTML attribute that tells search engines about language and regional versions of a page. It helps Google serve the correct URL to users based on their language or location. Format: hreflang=“en-US” (English for US). Hreflang must be bidirectional - all versions must reference each other and themselves.

What is Hreflang?

Hreflang is an attribute that indicates the language and optionally the geographic target of a webpage. It’s used when you have multiple versions of content for different languages or regions.

Hreflang purposes:

  • Show correct language version in search results
  • Prevent duplicate content issues between versions
  • Target specific geographic markets
  • Improve user experience for international visitors

When to Use Hreflang

Use Hreflang When

  • Same content in multiple languages
  • Same language, different regions (en-US vs en-GB)
  • Translated pages with equivalent content
  • Regional variations with different pricing/products

Don’t Need Hreflang When

  • Single language website
  • No regional targeting needed
  • Automatically translated content (consider noindex)
  • Different content that happens to be in different languages

Hreflang Syntax

Language Only

Use ISO 639-1 language codes.

<link rel="alternate" hreflang="en" href="https://example.com/page/">
<link rel="alternate" hreflang="es" href="https://example.com/es/page/">
<link rel="alternate" hreflang="de" href="https://example.com/de/page/">

Language + Region

Combine language code with ISO 3166-1 Alpha-2 country code.

<link rel="alternate" hreflang="en-US" href="https://example.com/us/page/">
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/page/">
<link rel="alternate" hreflang="en-AU" href="https://example.com/au/page/">

x-default

Specifies fallback for unmatched languages/regions.

<link rel="alternate" hreflang="x-default" href="https://example.com/page/">

Complete Hreflang Example

For a page with English, Spanish, and German versions:

<head>
  <!-- Self-reference -->
  <link rel="alternate" hreflang="en" href="https://example.com/page/">

  <!-- Other versions -->
  <link rel="alternate" hreflang="es" href="https://example.com/es/pagina/">
  <link rel="alternate" hreflang="de" href="https://example.com/de/seite/">

  <!-- Fallback -->
  <link rel="alternate" hreflang="x-default" href="https://example.com/page/">
</head>

Important: Each version must include ALL hreflang tags, including self-reference.

Implementation Methods

<link rel="alternate" hreflang="en" href="https://example.com/page/">

Pros: Easy to implement, visible in source Cons: Adds to page size, must update each page

HTTP Headers

For non-HTML files (PDFs).

Link: <https://example.com/page/>; rel="alternate"; hreflang="en",
      <https://example.com/es/page/>; rel="alternate"; hreflang="es"

XML Sitemap

<url>
  <loc>https://example.com/page/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/page/"/>
  <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/pagina/"/>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/seite/"/>
</url>

Pros: Centralized management, easier updates Cons: Not visible on page, may have crawl delay

Common Hreflang Codes

Language Codes (ISO 639-1)

CodeLanguage
enEnglish
esSpanish
deGerman
frFrench
zhChinese
jaJapanese
ptPortuguese
arArabic
msMalay

Country Codes (ISO 3166-1)

CodeCountry
USUnited States
GBUnited Kingdom
DEGermany
FRFrance
ESSpain
AUAustralia
MYMalaysia
SGSingapore

Combined Examples

HreflangTarget
en-USEnglish for US
en-GBEnglish for UK
es-ESSpanish for Spain
es-MXSpanish for Mexico
pt-BRPortuguese for Brazil
pt-PTPortuguese for Portugal
zh-CNChinese for China (Simplified)
zh-TWChinese for Taiwan (Traditional)

Hreflang Best Practices

Bidirectional Requirement

All pages must reference each other.

Correct:

Page A (en) references: A (en), B (es), C (de)
Page B (es) references: A (en), B (es), C (de)
Page C (de) references: A (en), B (es), C (de)

Incorrect:

Page A (en) references: B (es), C (de)  // Missing self-reference
Page B (es) references: A (en)          // Missing C

Use Absolute URLs

<!-- Correct -->
<link rel="alternate" hreflang="en" href="https://example.com/page/">

<!-- Incorrect -->
<link rel="alternate" hreflang="en" href="/page/">

Match Canonical URLs

Hreflang URLs should match canonical URLs.

<link rel="canonical" href="https://example.com/page/">
<link rel="alternate" hreflang="en" href="https://example.com/page/">

Return 200 Status

All hreflang URLs must return 200 (not redirects or errors).

Include Self-Reference

Always include the current page in hreflang.

URL Structures for International Sites

example.com/en/
example.com/es/
example.com/de/

Pros: Easy to implement, shared domain authority Cons: No separate geo-targeting in Search Console

Subdomains

en.example.com
es.example.com
de.example.com

Pros: Can geo-target in Search Console Cons: Separate domain authority, more setup

ccTLDs

example.com (US)
example.co.uk (UK)
example.de (Germany)

Pros: Strong geo-signal, local trust Cons: Separate domains to manage, divided authority

Troubleshooting Hreflang

Common Errors

ErrorCauseSolution
Missing return linksOne-directional referencesAdd reciprocal tags
Wrong codesInvalid language/countryUse correct ISO codes
Broken linksURLs return errorsFix or remove URLs
Conflicting signalsCanonical conflictsAlign canonical and hreflang

Validation Tools

  • Google Search Console (International Targeting)
  • Hreflang Tags Testing Tool
  • Ahrefs/Semrush site audit
  • Screaming Frog

Search Console Reports

Check:

  • International Targeting section
  • Coverage report for hreflang errors
  • URL Inspection for specific pages

Hreflang Checklist

Implementation

  • All language versions identified
  • Correct ISO codes used
  • x-default included
  • Absolute URLs used
  • Self-reference on each page

Validation

  • Bidirectional links verified
  • All URLs return 200
  • Canonical URLs match
  • No conflicting signals
  • Search Console checked

Maintenance

  • New pages get hreflang
  • Removed pages cleaned up
  • URL changes updated
  • Regular audits scheduled

Conclusion

Hreflang is essential for multilingual and international websites. It ensures users see the correct language version in search results and prevents duplicate content issues between regional versions.

Implement hreflang on all alternate versions, always include self-reference, and ensure bidirectional linking. Use x-default as a fallback for unmatched languages. Validate regularly with Search Console and site audit tools.

Combine hreflang with proper canonicalization and international SEO strategy for effective global search visibility.

Frequently Asked Questions

Do I need hreflang for different English versions (US, UK, AU)?
Yes, if you have distinct content for different English-speaking regions (different spellings, pricing, products), use hreflang with region codes: en-US, en-GB, en-AU. If the content is identical, you may not need separate versions. Hreflang helps prevent duplicate content issues between regional versions.
What is x-default in hreflang?
x-default specifies the default or fallback page when no other hreflang matches the user's language/region. It's typically your main language version or a language selector page. Always include x-default to handle users whose language isn't specifically targeted.
Does hreflang affect rankings?
Hreflang doesn't directly boost rankings, but it helps the correct page rank in the correct market. Without hreflang, the wrong language version might rank in a market, or versions might compete against each other. Proper implementation ensures the right page appears for the right audience.