Hreflang SEO: Complete Implementation Guide
Learn how hreflang SEO helps search engines understand multilingual and multi-regional pages. This guide explains hreflang syntax, language and country codes, self-referencing tags, reciprocal links and the technical rules required for reliable international targeting.
What Is Hreflang in SEO?
Hreflang is an HTML annotation used to identify alternate language or regional versions of a webpage.
Language Alternatives
Hreflang can connect equivalent pages written in English, French, German, Dutch or other languages.
- English and translated pages
- Multilingual product content
- Language-specific service pages
Regional Alternatives
Pages in the same language can target different countries where pricing, spelling, delivery or regulations differ.
- English UK and English US
- French France and French Canada
- Spanish Spain and Spanish Mexico
Alternate Page Relationships
Hreflang tells search engines that several URLs are related versions rather than unrelated competing pages.
- Equivalent page intent
- Comparable products or services
- Shared international page groups
Every Alternate Page Should Reference the Other Valid Versions
When a UK page references a US alternative, the US page should reference the UK page in return. Each page should normally also include a self-referencing hreflang annotation. This creates a complete and verifiable language cluster.
Correct Hreflang Tag Structure and Examples
An HTML hreflang annotation contains the relationship type, target language or region and the absolute URL of the alternate page.
Understanding Each Part of the Tag
Hreflang tags are normally placed inside the
<head> of each related HTML page.
<link rel="alternate"
hreflang="en-gb"
href="https://example.com/uk/page/" />
UK, US and German Versions
The following complete set should appear on each equivalent page.
<link rel="alternate" hreflang="en-gb"
href="https://example.com/uk/services/" />
<link rel="alternate" hreflang="en-us"
href="https://example.com/us/services/" />
<link rel="alternate" hreflang="de-de"
href="https://example.com/de/dienstleistungen/" />
<link rel="alternate" hreflang="x-default"
href="https://example.com/services/" />
The language normally comes first and may be followed by an
optional regional code, such as en-gb. A country
code by itself, such as gb, is not a valid hreflang
value because hreflang must identify a language.
Three Ways to Implement Hreflang
Hreflang can be implemented in HTML, XML sitemaps or HTTP headers. Use one consistent method for each alternate page set.
HTML Head Tags
Add alternate link elements inside the
<head> section of every related HTML page.
<link rel="alternate"
hreflang="en-gb"
href="https://example.com/uk/" />
<link rel="alternate"
hreflang="en-us"
href="https://example.com/us/" />
- Easy to inspect in page source
- Suitable for ordinary webpages
- Must appear on every alternate page
XML Sitemap Annotations
Include alternate language relationships inside an XML sitemap using the XHTML namespace.
Simplified Example<url>
<loc>https://example.com/uk/</loc>
<xhtml:link
rel="alternate"
hreflang="en-us"
href="https://example.com/us/" />
</url>
- Keeps page HTML cleaner
- Useful for large URL inventories
- Requires careful sitemap management
HTTP Response Headers
Use the HTTP Link header for non-HTML documents
such as PDFs or downloadable files.
Link:
<https://example.com/uk-file.pdf>;
rel="alternate";
hreflang="en-gb",
<https://example.com/de-datei.pdf>;
rel="alternate";
hreflang="de-de"
- Works for non-HTML files
- Configured at server level
- More difficult to inspect manually
Use the Method Your Website Can Maintain Reliably
Search engines can process all three methods. The best choice is the one your CMS, development team or international SEO workflow can keep accurate whenever pages are added, removed, redirected or migrated.
How Hreflang Language and Country Codes Work
A valid hreflang value begins with a language code and may include an optional regional code after a hyphen.
Correct Hreflang Code Formats
Use a two-letter language code by itself when the page serves speakers of that language generally. Add a region when the page is specifically adapted for one country or market.
Common Hreflang Examples
These examples show how language and market targeting can be combined across international page sets.
Common Code Mistakes
Country codes cannot normally be used alone because hreflang must identify a language first.
Use Language First, Then Region
Use recognised language codes followed by an optional regional code separated with a hyphen.
How Hreflang Works With Canonical Tags and X-Default
Hreflang identifies valid alternate pages, while canonical tags identify the preferred URL within each individual language version.
Self-Canonical International Pages
Each valid language or regional page should normally canonicalise to itself rather than to another country version.
Hreflang Does Not Replace Canonicals
Canonical and hreflang annotations serve different purposes and may appear together on the same page.
X-Default as a Fallback
The x-default value identifies the fallback page
when no specific language or regional version is the best match.
Keep Canonical and Hreflang Signals Consistent
A page should not normally declare itself as a valid regional alternative while simultaneously canonicalising to a different country version. Conflicting signals can weaken the alternate relationship.
UK Page With Canonical and Alternates
The UK page canonicalises to itself and lists each valid international alternative.
<link rel="canonical"
href="https://example.com/uk/services/" />
<link rel="alternate"
hreflang="en-gb"
href="https://example.com/uk/services/" />
<link rel="alternate"
hreflang="en-us"
href="https://example.com/us/services/" />
<link rel="alternate"
hreflang="de-de"
href="https://example.com/de/dienstleistungen/" />
<link rel="alternate"
hreflang="x-default"
href="https://example.com/services/" />
Common Hreflang Errors and How to Fix Them
Hreflang failures usually come from incomplete page relationships, invalid URLs, inconsistent codes or conflicting indexation signals.
Missing Return Tags
Page A references Page B, but Page B does not reference Page A in return.
Fix: add reciprocal annotations across the complete page set.Missing Self-References
A page lists alternate versions but omits its own language or regional URL.
Fix: include the current URL within its own hreflang set.Invalid Language Codes
The annotation uses country-only codes, underscores or unsupported custom abbreviations.
Fix: use valid language-first formats such as en-gb.Redirected Alternate URLs
Hreflang points to a URL that redirects instead of resolving directly with a successful response.
Fix: reference the final canonical destination URL directly.Non-Indexable Pages
Alternate URLs are blocked by robots rules, marked noindex or canonicalised elsewhere.
Fix: include only valid, indexable alternate pages.Inconsistent Alternate Sets
Different pages within one cluster list different countries or omit valid alternatives.
Fix: use the same complete set on every equivalent page.Relative URLs
Annotations use partial paths instead of complete URLs with the protocol and hostname.
Fix: use absolute URLs for every alternate reference.Unrelated Page Pairing
Hreflang connects pages that do not offer substantially equivalent content or search intent.
Fix: connect only genuine language or regional equivalents.Audit the Entire Alternate Cluster, Not Just One Page
A tag may look correct on one URL while the wider relationship still fails. Review every alternate page, canonical, response status, indexation directive and return annotation together.
How to Test Hreflang Implementation
Test the complete international page cluster after implementation, migration, redesigns and major URL changes.
Inspect the Rendered Page Source
Confirm that each expected hreflang annotation appears in the final HTML output rather than only inside a CMS setting.
Expected: one complete and consistent alternate set.Check Every Referenced URL
Open each alternate destination and verify that it loads directly without a redirect, server error or soft 404.
Expected: valid indexable pages returning successful responses.Verify Return Annotations
Check that every alternate page references the original page and the other members of the same international set.
Expected: reciprocal relationships across the entire cluster.Review Canonical Tags
Confirm that each indexable regional page normally uses a self-referencing canonical rather than pointing elsewhere.
Expected: canonical and hreflang signals remain aligned.Validate Language and Region Codes
Check spelling, hyphen use and whether each value follows a recognised language-first format.
Expected: values such as en-gb, en-us and de-de.Compare the Alternate Page Content
Make sure linked pages genuinely represent equivalent topics, products, services or user journeys.
Expected: equivalent intent with appropriate localisation.Review Indexation Directives
Check that alternate pages are not blocked, noindexed or excluded through conflicting technical directives.
Expected: valid pages remain crawlable and indexable.Re-Test After URL Changes
Hreflang clusters should be reviewed whenever URLs are redirected, migrated, removed or moved to another structure.
Expected: annotations point directly to current final URLs.Validate Technical Signals Before Reviewing Search Performance
Hreflang is only one part of international SEO. Before attributing visibility problems to the annotations, confirm that the pages are crawlable, indexable, internally linked, canonicalised and sufficiently localised for their intended audiences.
How to Add Hreflang Tags in WordPress
WordPress can output hreflang through a multilingual plugin, custom development or a dedicated international SEO setup.
Multilingual WordPress Plugins
Established multilingual plugins can connect translated pages and output hreflang annotations automatically.
- Link translations within the plugin interface
- Assign the correct language and regional settings
- Inspect the final output after configuration
Custom Theme or Plugin Output
Developers can generate alternate tags dynamically through the theme, a child theme or a purpose-built site plugin.
- Use a reliable page-to-page relationship system
- Output absolute URLs in the document head
- Update relationships when pages change
XML Sitemap Implementation
Larger WordPress websites can manage hreflang through a custom international XML sitemap rather than page-level HTML tags.
- Useful for extensive language inventories
- Requires valid XHTML namespace formatting
- Needs careful maintenance and testing
Always inspect the rendered page source or sitemap after setup. Conflicts can appear when translation plugins, SEO plugins, caching systems, canonical settings and custom redirects all influence the same international URLs.
Frequently Asked Questions About Hreflang SEO
Practical answers about implementation, canonicals, x-default, duplicate content and international targeting.
01 What does hreflang do in SEO?
Hreflang identifies alternate language or regional versions of a page so search engines can select a more appropriate version for a user.
02 Does every hreflang page need a self-reference?
Yes, each valid alternate page should normally include its own URL within the complete hreflang set.
03 What are hreflang return tags?
Return tags are reciprocal annotations. When one page references an alternate page, the alternate page should reference the original page in return.
04 Does hreflang prevent duplicate content?
Hreflang helps search engines understand relationships between similar international pages, but it does not replace canonical tags or fix weak localisation.
05 Can hreflang and canonical tags appear together?
Yes. Each indexable international page should normally canonicalise to itself while hreflang identifies the related language and regional alternatives.
06 What is x-default in hreflang?
The x-default value identifies a fallback
page, such as a global homepage or language selector,
when no specific version is the best match.
07 Can hreflang point to redirected URLs?
It should point directly to the final indexable URL. Redirected destinations add unnecessary complexity and can weaken the international page relationship.
08 Do I need hreflang for English pages in different countries?
It can be useful when separate English pages target different markets, such as the UK and US, especially when pricing, spelling, delivery or service details differ.
Keep International Pages Connected, Indexable and Consistent
Correct hreflang SEO depends on more than adding tags. Alternate URLs, canonical signals, redirects, language codes and page relationships must all remain technically aligned.