Hreflang
An HTML attribute that specifies the language and geographic region a page is intended for, helping search engines serve the correct language version to users in different countries.
Simple Explanation
Hreflang is a piece of HTML code that tells Google which version of your page to show users in different countries or speaking different languages. If your website has an English version and a Spanish version, hreflang tells Google: 'Show the Spanish version (/es/) to Spanish speakers, and the English version (/en/) to English speakers.' Without it, Google might show the wrong language version to the wrong audience — or treat your translated pages as duplicate content.
Advanced SEO Explanation
Hreflang uses BCP 47 language codes (en, es, fr-FR, pt-BR, zh-Hant) and follows a bidirectional relationship requirement — every page in a hreflang cluster must reference all other pages, including itself. Implementation can be via HTML link tags in <head>, HTTP Link headers (for non-HTML files), or XML sitemap hreflang entries (most scalable for large sites). Hreflang doesn't affect keyword rankings but determines which URL Google selects to serve for a search from a given region — solving the problem of Google showing the wrong language variant. Common pitfalls: missing self-referential tag, broken bidirectional linking (if page A links to page B via hreflang but page B doesn't link back to page A, Google ignores the signal), incorrect locale codes, and hreflang pointing to redirected or noindexed pages.
Why Hreflang Matters for Rankings
Serves correct language to each region
Without hreflang, Spanish-speaking users in Mexico might see your French version, and German users might see the English version — hurting engagement and conversions.
Prevents duplicate content across language versions
Multiple language versions of the same page could be interpreted as duplicate content without hreflang signals to distinguish their intended audiences.
Improves international ranking performance
Google can rank the most appropriate language version in each country's search results — improving click-through rate for users who see content in their language.
Enables country-specific targeting with gTLDs
Combines with ccTLDs (example.de for Germany) or subfolders (/de/) to send strong geographic targeting signals.
Real-World SEO Examples
Basic hreflang implementation in HTML
A page with English (default) and Spanish versions. Both pages must reference each other AND themselves.
Code Example
<!-- On English page (https://example.com/about/) -->
<link rel="alternate" hreflang="en" href="https://example.com/about/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/about/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/about/" />
<!-- On Spanish page (https://example.com/es/about/) -->
<link rel="alternate" hreflang="en" href="https://example.com/about/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/about/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/about/" />Country + language targeting
Using both language and country codes for precise targeting.
Code Example
<!-- Targeting English speakers in the UK vs USA vs Australia -->
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/product/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/product/" />
<link rel="alternate" hreflang="en-AU" href="https://example.com/en-au/product/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en-us/product/" />Common Hreflang Mistakes
✗ Mistake
Missing self-referential hreflang tag
✓ The Fix
Every page must include a hreflang tag pointing to itself. If the English page doesn't reference itself with hreflang='en', Google may ignore the entire cluster.
✗ Mistake
Broken bidirectional linking
✓ The Fix
If page A lists page B in its hreflang cluster, page B must also list page A. Pages missing from either direction cause Google to ignore the signal.
✗ Mistake
Using wrong language codes
✓ The Fix
Use BCP 47 language codes: 'en' not 'english', 'zh-Hant' for Traditional Chinese not 'zh-TW'. Incorrect codes are silently ignored.
✗ Mistake
Hreflang pointing to a redirected URL
✓ The Fix
Always point hreflang to the final destination URL. Linking to a 301 redirect causes Google to try to follow the chain, sometimes ignoring the hreflang signal.
✗ Mistake
Forgetting x-default for users without a matching locale
✓ The Fix
x-default tells Google which page to show users whose language doesn't match any listed locale. Always include it, typically pointing to your primary/default language version.
Free Tools for Hreflang
Related Articles
Hreflang FAQs
Frequently Asked Questions
People Also Search For
Continue Learning: Next Terms
Canonical Tag
An HTML element that signals to search engines which URL is the preferred, authoritative version of a page when similar content exists at multiple URLs.
Intermediate⚙️Indexing
The process by which Google adds a crawled page to its searchable database, making it eligible to appear in search results.
Beginner⚙️URL Parameters
Query string variables appended to URLs (after a ? symbol) that pass information to web servers, often creating duplicate content and crawl budget issues when not managed properly.
Intermediate📄Canonicalization
The process of selecting the single preferred URL when multiple URLs display the same or nearly identical content, to consolidate ranking signals and prevent duplicate content issues.
Intermediate