hreflang Explained
Understand hreflang tags, language targeting, regional targeting and how to implement hreflang correctly for international websites.
The hreflang attribute tells search engines which language and regional version of a webpage should be shown to users in different countries or language settings. It is an essential part of international SEO because it helps search engines deliver the most appropriate page while reducing confusion between similar multilingual versions.
Without hreflang, search engines may display the wrong language version in search results, leading to a poor user experience, lower engagement and reduced conversion rates.
What Is hreflang?
hreflang is an HTML attribute that specifies the language and, optionally, the region for a webpage. It creates relationships between equivalent pages that target different audiences while indicating that they are alternate versions rather than duplicate content.
Why hreflang Matters
International websites often publish similar content in multiple languages or regional variations. hreflang helps search engines understand these relationships and serve the most relevant version based on a user's language preferences and geographic location.
- Improve international SEO.
- Show users the correct language version.
- Reduce duplicate content confusion.
- Improve user experience.
- Support multilingual and multi-regional websites.
How hreflang Works
Each language version references all alternate versions, including itself. Search engines read these relationships and choose the page that best matches the user's language and regional settings.
English Page
↕
French Page
↕
German Page
↓
Search Engine Selects Best Version
↓
User Receives Appropriate LanguageBasic hreflang Example
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/" />Language and Region Codes
hreflang values use ISO language codes and may optionally include ISO country codes. Language codes are written first, followed by a hyphen and the country code when regional targeting is needed.
| hreflang | Meaning |
|---|---|
| en | English |
| en-US | English (United States) |
| en-GB | English (United Kingdom) |
| fr | French |
| de | German |
| es | Spanish |
When to Use hreflang
hreflang is appropriate whenever equivalent pages exist in multiple languages or regional versions. It is commonly used by international businesses, multilingual blogs, e-commerce websites and global documentation platforms.
The x-default Value
The special x-default hreflang value identifies the page that should be shown when no language or regional version is considered a better match. It is commonly used for language selection pages or default international homepages.
<link rel="alternate" hreflang="x-default" href="https://example.com/" />Language vs Regional Targeting
A language code targets everyone who speaks that language, while adding a country code creates a version intended for users in a specific region. Regional versions are useful when pricing, currencies, spelling or legal requirements differ between countries.
| Value | Targets |
|---|---|
| en | All English-speaking users |
| en-US | Users in the United States |
| en-GB | Users in the United Kingdom |
| fr-CA | French-speaking users in Canada |
Where hreflang Can Be Implemented
Search engines support hreflang through HTML link elements, HTTP response headers and XML sitemaps. Websites typically choose one implementation method and apply it consistently across all language versions.
| Method | Typical Usage |
|---|---|
| HTML <link> | Standard web pages |
| HTTP Header | PDFs and non-HTML resources |
| XML Sitemap | Large multilingual websites |
hreflang and Canonical URLs
Each language version should normally contain a self-referencing canonical tag while also referencing its alternate language versions through hreflang. Canonical tags identify the preferred URL for a specific language, whereas hreflang connects equivalent pages across different languages or regions.
Reciprocal References
If Page A references Page B with hreflang, Page B should also reference Page A. Reciprocal relationships help search engines confirm that pages belong to the same international content set.
Common Use Cases
| Website Type | Benefits of hreflang |
|---|---|
| International e-commerce | Country-specific products and pricing |
| Documentation websites | Language-specific guides |
| Corporate websites | Regional content |
| News websites | Localized editions |
Benefits for International SEO
Correct hreflang implementation improves user experience by directing visitors to the appropriate language version. It also helps search engines understand relationships between localized pages, reducing ambiguity when similar content exists across multiple regions.
Common Mistakes
hreflang implementations often fail because of inconsistent references or incorrect language codes. Since international websites usually contain many interconnected pages, even small configuration errors can prevent search engines from recognizing alternate language versions correctly.
- Using invalid or non-standard language or country codes.
- Missing reciprocal hreflang references between alternate pages.
- Pointing hreflang tags to redirected, broken or non-indexable URLs.
- Using canonical tags that conflict with hreflang relationships.
- Forgetting to include self-referencing hreflang annotations.
- Mixing unrelated pages within the same hreflang group.
Best Practices
- Use valid ISO language and country codes.
- Ensure every alternate page references all other language versions.
- Include self-referencing hreflang annotations.
- Use self-referencing canonical tags on each language version.
- Validate hreflang implementation after publishing new pages.
- Keep language versions synchronized as content evolves.
Frequently Asked Questions
What is hreflang used for?
hreflang tells search engines which language or regional version of a webpage should be shown to users based on their language preferences and geographic location.
Do all pages need hreflang tags?
Only pages that have equivalent versions in other languages or regions need hreflang annotations. Monolingual websites generally do not require them.
What is x-default?
The x-default value identifies the fallback page that should be shown when no language or regional version is considered a better match. It is commonly used for language selector pages or default homepages.
Can hreflang replace canonical tags?
No. Canonical tags identify the preferred URL for a page, while hreflang connects equivalent pages across different languages or regions. Both serve different purposes and are often used together.
Does hreflang improve search rankings?
Not directly. Its primary benefit is helping search engines serve the correct language version to users, improving user experience and reducing confusion between multilingual pages.
Helpful SEO Tools
An hreflang Generator creates correctly formatted alternate language tags, a Canonical URL Generator helps configure self-referencing canonical URLs for multilingual pages, a Meta Tag Generator produces common HTML metadata used alongside hreflang, an Open Graph Generator creates social sharing metadata for localized pages, and a Sitemap Generator can generate XML sitemaps that include hreflang annotations for large international websites.
Conclusion
hreflang is a key component of international SEO, helping search engines deliver the most appropriate language and regional version of a webpage to each user. When implemented with valid language codes, reciprocal references, self-referencing canonical tags and a well-organized site structure, hreflang improves the experience for global audiences while making multilingual websites easier for search engines to understand and index.