hreflang
hreflang tells search engines which language and region each version of a page serves. If you run the same content for French and French Canadian, this prevents the wrong one from showing. If your site is in one language only, you do not need it.
By Théophile Louvart, founder of Porteur · Updated 14 September 2026 · Markdown
What hreflang declares
hreflang is a set of link rel alternate tags that map equivalent pages to languages and regions. Values use ISO 639-1 for language, and optionally ISO 3166-1 Alpha 2 for region.
Example: /pricing in English for the UK and Canada, and French for Canada. You declare en-GB, en-CA and fr-CA on each version, plus x-default if you have a fallback.
When a small site needs it
Use hreflang only when you have equivalent pages in multiple languages or regions. If your site is English only, skip it.
- Same content in multiple languages: /guides/getting-started in en and fr.
- Same language, different regional variants: en-GB and en-US with spelling or pricing changes.
- Non-HTML alternates like a PDF user guide in multiple languages.
Do not use hreflang to target cities or to fix duplicate content. It is not a replacement for canonical or for proper redirects.
Where to declare hreflang
You can declare hreflang in three places. Pick one approach and keep it consistent across the site.
- HTML head: link rel="alternate" hreflang="xx-YY" href="..." on every version.
- XML sitemap: list alternates inside <xhtml:link> for each URL entry.
- HTTP header: for non-HTML files like PDFs where you cannot edit HTML.
<!-- HTML head on https://yourproduct.com/pricing -->
<link rel="alternate" hreflang="en-GB" href="https://yourproduct.com/uk/pricing" />
<link rel="alternate" hreflang="en-CA" href="https://yourproduct.com/ca/pricing" />
<link rel="alternate" hreflang="fr-CA" href="https://yourproduct.com/ca-fr/pricing" />
<link rel="alternate" hreflang="x-default" href="https://yourproduct.com/pricing" /><!-- XML sitemap entry for https://yourproduct.com/uk/pricing -->
<url>
<loc>https://yourproduct.com/uk/pricing</loc>
<xhtml:link rel="alternate" hreflang="en-GB" href="https://yourproduct.com/uk/pricing"/>
<xhtml:link rel="alternate" hreflang="en-CA" href="https://yourproduct.com/ca/pricing"/>
<xhtml:link rel="alternate" hreflang="fr-CA" href="https://yourproduct.com/ca-fr/pricing"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://yourproduct.com/pricing"/>
</url># HTTP header on a PDF
Link: <https://yourproduct.com/guide-en.pdf>; rel="alternate"; hreflang="en",
<https://yourproduct.com/guide-fr.pdf>; rel="alternate"; hreflang="fr"Rules that prevent errors
- Reciprocal: every version must list every other version, including itself.
- Codes: use ISO 639-1 for language, optionally plus ISO 3166-1 Alpha 2 for region, like en or en-GB.
- Self-referencing: include a tag for the page’s own hreflang and URL.
- x-default: point to a neutral or selector page for unmatched users, like /intl.
- Canonical: each page should canonical to itself, not to another variant.
A fixed page has a complete, mirrored set of alternates on each version, with valid codes and a self-reference. The canonical points to the page itself.
How to check and measure it
List your alternates
For each template, list the exact URL for each language or region, including any selector or x-default.
Implement in one place
Add tags in head, or sitemap entries, or HTTP headers. Do not mix methods across the same URLs.
Validate reciprocity
Open each version and confirm it lists all others, including itself. Repeat after any URL change.
Check Search Console
Use Search Console’s international targeting checks for errors. Fix missing return links, wrong codes and unknown URLs.
Spot crawl errors
Run a crawler that reports hreflang, and export issues like non-200 targets or mismatched pairs.
Watch impressions by country and language in the performance report. A correct setup reduces the wrong-country impressions on pages like /pricing.
Questions
It tells search engines which language and region each version of a page serves. If you have en-GB and en-US versions, hreflang helps show the right one to the right searcher.
Say h-ref-lang. The h comes from the HTML attribute href in link tags, and lang is for language.
Pick one method: link tags in the HTML head, entries in your XML sitemap, or HTTP headers for non-HTML files. Add reciprocal entries across all equivalents, include self-references, and add x-default if you have a fallback.
Use x-default when you have a neutral or selector page for users who do not match any language or region. If every user should land on a specific variant, you can skip it.
Yes. Each variant should canonical to itself and list alternates via hreflang. Do not canonical one language to another, or you will suppress it.
No. Use a language code, optionally plus a region. en-GB is valid. GB alone is not.
Sources
Check my site, free
Want to see if your alternates are reciprocal and valid, and where you miss x-default, from one URL? Run the free Porteur check in about thirty seconds.
- Free check, no card
- Read-only, your own accounts
- Readable by your agent
Read next
- GlossaryCanonical URL
- GuideAlternate page with proper canonical tag: what Search Console means
- GlossaryXML sitemap
- GuideThe Sitemaps report: what Success, Has errors and Couldn’t fetch mean
- GuideHow to use Google Search Console in ten minutes a week
- GuideTechnical SEO checklist for a small site
- Free toolhreflang checker
- Guidehreflang implementation: head, sitemap or header, and the checks