13 min read · Technical SEO · Last updated July 2026
Quick answer: hreflang tags tell Google which version of a page to show users based on their language and region. Every page in a language set must reference all other variants reciprocally, or the tags are invalid. One broken reciprocal tag breaks the entire set.
Introduction
Getting international SEO right starts with one decision: how do you tell Google which page is for which audience? Without hreflang, Google guesses — and often serves the wrong country’s version to the wrong users, splitting ranking signals across variants and leaving revenue on the table.
hreflang is the HTML attribute that solves this. It’s also one of the most error-prone technical SEO implementations. The reciprocal requirement alone breaks most partial implementations. Add in the subtleties of language vs. region codes, x-default behavior, and sitemap vs. HTML placement, and it’s easy to implement something that looks correct but does nothing.
This guide walks through every component of a correct hreflang implementation.
What you’ll learn:
– Correct language and region code syntax
– The reciprocal tag requirement and why a single missing tag breaks everything
– x-default: when and how to use it
– Sitemap hreflang vs. HTML implementation — when to use each
– Validation tools and how to interpret errors
Table of Contents
- What hreflang Does and When You Need It
- Language and Region Code Syntax
- Where to Place hreflang Tags
- The Reciprocal Requirement: The Most Broken Part
- x-default: Handling the Unmatched User
- Sitemap hreflang Implementation
- Common hreflang Errors
- Validating Your hreflang Implementation
What hreflang Does and When You Need It
hreflang solves two problems: language targeting and regional targeting.
Language targeting: If you have an English page and a Spanish page covering the same content, hreflang tells Google to show the Spanish page to Spanish-speaking users and the English page to English-speaking users.
Regional targeting: If you have a US English page (/en-us/) and an Australian English page (/en-au/), hreflang tells Google to serve the US page to US users and the Australian page to Australian users — even though both are in English.
When you need hreflang:
– Your site serves content in multiple languages
– Your site has separate versions for different regions (US/UK/AU pricing, local terminology)
– You run country-specific domains (example.com, example.co.uk, example.com.au)
– You have a multilingual site on subdomains (en.example.com, es.example.com) or subdirectories (/en/, /es/)
When you don’t need hreflang:
– You have one version of your site with a single language and no regional variations
– Your site handles language via browser-side translation tools without separate pages
Language and Region Code Syntax
hreflang uses ISO 639-1 language codes and ISO 3166-1 Alpha-2 country codes:
<!-- Language only -->
<link rel="alternate" hreflang="es" href="https://example.com/es/" />
<!-- Language + Region -->
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/" />
<link rel="alternate" hreflang="en-AU" href="https://example.com/en-au/" />
<!-- Self-referencing (this page's own language) -->
<link rel="alternate" hreflang="en" href="https://example.com/" />
<!-- Default fallback -->
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Language code rules:
– Always lowercase: en, es, fr, zh, ar
– Two-letter ISO 639-1 codes: en (English), es (Spanish), fr (French), de (German), zh (Chinese), ja (Japanese), pt (Portuguese), ar (Arabic)
– Three-letter codes (ISO 639-2) are not supported by Google
– For Chinese: use zh-Hans (Simplified) or zh-Hant (Traditional), not just zh
Region code rules:
– Always uppercase: US, GB, AU, NP, IN
– Use the hyphen to separate language and region: en-US, not en_US
– Region codes are optional — use them only when you have genuinely different content for different regions of the same language
Common correct codes:
– en-US — English, United States
– en-GB — English, United Kingdom
– en-AU — English, Australia
– es-ES — Spanish, Spain
– es-MX — Spanish, Mexico
– pt-BR — Portuguese, Brazil
– pt-PT — Portuguese, Portugal
– zh-Hans — Chinese, Simplified (Mainland China)
– zh-Hant — Chinese, Traditional (Taiwan, Hong Kong)
– ne-NP — Nepali, Nepal
hreflang Code Generator
hreflang Tag Generator
Add your language/region variants to generate the complete hreflang tag set.
The Reciprocal Requirement: The Most Broken Part
This is where most hreflang implementations fail.
Every page in a hreflang set must reference every other page in the set. If you have English (/en/), Spanish (/es/), and French (/fr/) versions, each page must contain all three hreflang tags — including a tag pointing to itself.
On /en/page/:
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />
On /es/page/:
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />
On /fr/page/:
<link rel="alternate" hreflang="en" href="https://example.com/en/page/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/page/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page/" />
If the French page is missing from the English page’s hreflang set, Google ignores the French page’s reciprocal claim pointing to the English page. The entire three-way relationship breaks.
Scale consideration: A site with 10 languages and 5,000 pages has 50,000 hreflang tag sets, each containing 10 tags. That’s 500,000 total hreflang tags. Managing this in HTML is error-prone at scale — use sitemap hreflang instead.
x-default: Handling the Unmatched User
x-default specifies the page to show when no other hreflang tag matches the user’s language/region:
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Use x-default for:
– A language selection page where users pick their preferred language
– An English homepage that serves as the global default
– A neutral international page not targeted at any specific region
Don’t confuse x-default with “the most important page.” It’s specifically for users whose language/region has no dedicated hreflang variant. If you target English speakers worldwide with hreflang="en", you may still want x-default pointing to the same English page for users from countries with no specific variant.
If your site serves 5 languages and a user comes from a country not covered by any of those languages, x-default determines what they see.
Sitemap hreflang Implementation
For large sites, managing hreflang in HTML is error-prone. Sitemap hreflang is cleaner at scale.
In your XML sitemap:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/en/page/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/"/>
<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/page/"/>
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/page/"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/page/"/>
</url>
<url>
<loc>https://example.com/es/page/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/"/>
<xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/page/"/>
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/page/"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/page/"/>
</url>
</urlset>
The reciprocal requirement still applies — every URL in a set must appear in the sitemap with the full set of xhtml:link tags.
Sitemap hreflang advantages:
– Easier to manage programmatically
– Single source of truth for all hreflang relationships
– No risk of tags being omitted on specific pages due to template errors
Common hreflang Errors
1. Missing reciprocal tags. Page A references Page B, but Page B doesn’t reference Page A. The entire set is ignored by Google.
2. Wrong language codes. Using en-uk instead of en-GB, or pt-br instead of pt-BR. Language codes are case-insensitive for Google, but region codes should be uppercase by convention. More critically, using unsupported or invented codes causes the tag to be ignored.
3. hreflang pointing to non-200 URLs. Tags pointing to 404 or redirected URLs break the set. Every URL in your hreflang implementation must return a 200 status.
4. Using hreflang for the same content. hreflang is for alternate language/region versions — not for duplicate content you want to consolidate. Use canonical tags for duplicate content on the same language.
5. Missing self-referencing hreflang. Every page must include a tag pointing to itself with its own language code. It’s not optional.
6. Absolute URLs not used. Use href="https://example.com/es/" not href="/es/". Relative URLs in hreflang are not supported.
7. Page canonical conflicts with hreflang. If a page’s canonical tag points to a different URL than the page itself, the hreflang relationship is undefined. Ensure canonical and hreflang are consistent.
Validating Your hreflang Implementation
Merkle’s hreflang Testing Tool (technicalseo.com/tools/hreflang): Enter a URL and it checks reciprocal tags, code validity, and URL accessibility.
Ahrefs Site Audit: Flags hreflang errors including missing reciprocals, invalid codes, and broken URLs in hreflang attributes.
Screaming Frog: Under International → hreflang, see every page’s hreflang tags, check reciprocal validation, and identify non-200 URLs referenced.
Google Search Console: The International Targeting report shows hreflang errors. Less detailed than crawl-tool reports, but useful for confirming Google’s perspective.
Key takeaway: hreflang is binary — it either works correctly for the full set or it doesn’t work at all. One missing reciprocal, one invalid language code, or one broken URL in the set invalidates Google’s ability to use the relationship. Test every implementation with a validation tool before considering it complete.
Frequently Asked Questions
Q: Do I need hreflang if I only have one language but serve multiple countries?
A: Yes, if you have meaningfully different content per country (prices, phone numbers, addresses, legal text). Use en-US, en-GB, en-AU to target specific regional audiences even within the same language.
Q: Can I implement hreflang in both HTML and the sitemap?
A: Yes, but you don’t need both. Choose one method and be consistent. If both exist and they conflict, it can confuse Google.
Q: How long does it take for hreflang to take effect?
A: Typically 1-4 weeks after implementation, depending on crawl frequency. Use Google Search Console’s International Targeting report to monitor for errors and confirm Google is reading your tags.
Q: Does hreflang help with ranking in different countries?
A: hreflang tells Google which page to show for which audience — it doesn’t directly boost rankings. The ranking benefit comes from serving the right content to the right user, which improves engagement signals and reduces pogo-sticking.
Q: What’s the maximum number of hreflang tags per page?
A: There’s no official limit, but keep them manageable. For sites with 50+ language/region variants, sitemap hreflang is much cleaner than putting 50+ tags in every page’s <head>.
Conclusion
hreflang implementation is unforgiving. The reciprocal requirement means one error in a set of 10 languages breaks all 10 relationships. The investment to get it right — correct language codes, complete reciprocal tags, x-default for unmatched users — pays off in precise audience targeting, reduced international content duplication, and stronger organic performance in each target market.
Test every implementation before launch and validate with Screaming Frog or Ahrefs. Don’t assume it’s working — confirm it.
Let Ignited Nepal Handle This
International SEO is a specialty area requiring precise technical implementation and a deep understanding of how Google handles multilingual content. We’ve implemented hreflang for sites serving 20+ language variants across e-commerce, SaaS, and media platforms.
→ Request a Free Technical SEO Audit
Written by the Ignited Nepal SEO team. We build organic search systems for businesses across Nepal, Australia, UAE, USA, UK, and beyond. ignitednepal.com