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

Updated 2026-09-14 · Source: https://porteur.ai/glossary/hreflang

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

> hreflang picks which version to show. It does not merge ranking signals across versions.

## 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
<!-- 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
<!-- 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
# 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.

> Do not mix en-UK or other non-standard codes. If you target the UK, use en-GB.

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

### What is hreflang used for?

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.

### How do you pronounce "hreflang"?

Say h-ref-lang. The h comes from the HTML attribute href in link tags, and lang is for language.

### How do I add hreflang?

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.

### Do I need x-default?

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.

### Should hreflang work with canonicals?

Yes. Each variant should canonical to itself and list alternates via hreflang. Do not canonical one language to another, or you will suppress it.

### Can I target a country without a language code?

No. Use a language code, optionally plus a region. en-GB is valid. GB alone is not.

## Read next

- [Canonical URL](https://porteur.ai/glossary/canonical-url): A canonical URL names the original version of a page. Use it to handle parameters and duplicates, avoid split signals and keep the right page indexed.
- [Alternate page with proper canonical tag: what Search Console means](https://porteur.ai/guides/alternate-page-with-proper-canonical-tag): What this Search Console status means, when to ignore it, when it hides the wrong page, and the exact checks and fixes to set the right canonical.
- [XML sitemap](https://porteur.ai/glossary/xml-sitemap): What to put in sitemap.xml, how lastmod works, how to create, validate and submit your XML sitemap, and the traps to avoid.
- [The Sitemaps report: what Success, Has errors and Couldn’t fetch mean](https://porteur.ai/guides/search-console-sitemaps-report): How to submit your sitemap URL, read Success, Has errors and Couldn’t fetch, and fix invalid XML, 404s, cross‑host URLs and missing child sitemaps.
- [How to use Google Search Console in ten minutes a week](https://porteur.ai/guides/how-to-use-google-search-console): A quick weekly routine: set four filters, compare 28 days, check pages then queries, and fix three findings, without getting lost in noise.
- [Technical SEO checklist for a small site](https://porteur.ai/guides/technical-seo-checklist): Run these 20 technical SEO checks, in order. Each shows how to check it free and what fixed looks like for a site under 1,000 pages.
- [hreflang checker](https://porteur.ai/tools/hreflang-checker): Paste a URL and check its hreflang: the versions declared, whether the codes are ones Google reads, the self-reference, whether each version points back.

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: https://porteur.ai/
