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 , 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

  1. List your alternates

    For each template, list the exact URL for each language or region, including any selector or x-default.

  2. Implement in one place

    Add tags in head, or sitemap entries, or HTTP headers. Do not mix methods across the same URLs.

  3. Validate reciprocity

    Open each version and confirm it lists all others, including itself. Repeat after any URL change.

  4. Check Search Console

    Use Search Console’s international targeting checks for errors. Fix missing return links, wrong codes and unknown URLs.

  5. 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

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