# What is Hreflang?

> Hreflang is an HTML or HTTP annotation that tells search engines which language and regional versions of a page exist, so each user gets the right one.

URL: https://yes-seo.com/glossary/hreflang

**Hreflang** is an attribute that connects equivalent pages written for different languages or regions. It tells search engines “this page also exists in French, and in Spanish for Mexico — show each searcher the right one.” It doesn’t lift rankings by itself; it swaps in the best-matching version of a page that already ranks.

## What it looks like

```

-

```

The same block goes on *every* version, including a reference to the page itself. Each value is an ISO 639-1 language code, optionally followed by an ISO 3166-1 alpha-2 region code. `x-default` names the fallback for users who match none of the listed languages — often a language picker or the English page.

Google accepts three equivalent methods: HTML link elements, an HTTP `Link` header (useful for PDFs) or `xhtml:link` entries in your [XML sitemap](https://yes-seo.com/glossary/xml-sitemap). All three are documented in [Google’s guide to localized versions](https://developers.google.com/search/docs/specialty/international/localized-versions). Pick one method and use it consistently.

## Why it matters

Without hreflang, a French-speaking Canadian might land on your France page with euro prices, or Google may treat near-identical US and UK English pages as duplicates and show only one of them. Correct annotations route each user to their version and keep your regional pages from competing with each other.

## Common mistakes

**Missing return links.** If page A lists page B, page B must list page A. Google ignores one-way annotations.

- **Invalid codes.** `en-UK` is wrong (the region code is `GB`), `es-LA` isn’t a country, and a region on its own, like `hreflang="us"`, isn’t allowed.

- **Pointing at non-canonical URLs**, redirects or noindexed pages. Every hreflang URL should be the [canonical](https://yes-seo.com/glossary/canonical-tag), indexable version.

- **Canonicalizing every language to one page.** A French page whose canonical points to the English page is declared a duplicate, which cancels its hreflang.

- **Automatic redirects by IP or browser language**, which can stop Googlebot — crawling mostly from US addresses — from ever reaching your other versions.

Hreflang doesn’t translate or localize anything. Each version still needs genuinely adapted content — language, currency, phone numbers, shipping details — or Google may see near-duplicates.

## Check your annotations

The [hreflang checker](https://yes-seo.com/hreflang-checker) reads alternates from the HTML and HTTP headers, validates language and region codes, x-default and self-reference, and fetches up to 10 alternates to confirm return links and canonicals. Targeting a city rather than a language? That’s [local SEO](https://yes-seo.com/glossary/local-seo).

## Frequently asked questions

### Do I need hreflang if my site has only one language?

No. Hreflang only matters when you have two or more versions of the same content for different languages or regions.

### Is hreflang the same as the HTML lang attribute?

No. The lang attribute declares the page’s language for browsers and screen readers. Google says it detects language from the visible content rather than from lang attributes, and uses hreflang to connect alternate versions.

### Does hreflang work across different domains?

Yes. Alternates can live on country domains such as example.fr and example.de, as long as every version links back to the others.

