Contact

What is Hreflang?

Definition

Hreflang is an HTML attribute that tells search engines about the versions of a page written for other languages or regions. It is added with rel=alternate link elements, HTTP headers or an XML sitemap, and Google uses it to show each user the URL that best matches their language and location. Annotations must be reciprocal, and an x-default value can define a fallback.

Also known as: hreflang tag, hreflang attribute, rel=alternate hreflang, hreflang annotation

Diagram of Turkish and English pages linked to each other with reciprocal hreflang tags, plus an x-default fallback for other locales

The problem it solves

Picture a site with Turkish and English versions of the same page. Same topic, different audiences. Hreflang tells search engines “the English version of this page lives here, the Turkish one there,” so Google can show the Turkish URL to someone searching in Turkish and the English URL to someone searching in English.

Hreflang does not boost rankings. It swaps a ranking page for its equivalent in the right language. It also disambiguates near-identical pages in one language aimed at different countries, such as German pages for Germany and Austria.

Language and region codes

The value is an ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha-2 region code:

  • en: English speakers anywhere
  • en-GB: English speakers in the United Kingdom
  • pt-BR: Portuguese speakers in Brazil

A region on its own is not valid. Google states that codes outside those two standards, such as es-419, are not supported. A classic slip is en-UK; the correct region code is GB.

A working example

For a site with Turkish and English home pages, both pages carry the identical set in their head:

<link rel="alternate" hreflang="tr" href="https://www.example.com/" />
<link rel="alternate" hreflang="en" href="https://www.example.com/en/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />

The same data can be sent as an HTTP Link header for non-HTML files, or as xhtml:link entries in an XML sitemap, which is easier to maintain on large sites. All three are equivalent; pick one and apply it consistently.

Reciprocity and x-default

The rule most often missed: every version must list itself and every other version. If the Turkish page references the English one but the English page does not reference back, Google ignores the pair. This protects you from another site declaring itself an alternate of your page.

x-default names the fallback for users whose language matches none of the listed versions, typically a language picker or a home page that redirects by locale. It is optional, but recommended wherever a language selector exists.

Errors that quietly break it

  • Listing URLs that redirect, return 404 or carry noindex.
  • Canonicalizing language versions to one another. Each version should be its own canonical URL; hreflang should only connect canonical pages.
  • Relative URLs. Hreflang targets must be fully qualified, including protocol and host.
  • Annotating only the home page. The relationship is page-to-page, so every matching pair needs it.
  • Pairing an untranslated page with an unrelated page in another language. No equivalent means no hreflang for that page.

Checking and reference

Search Console's old International Targeting report has been retired, so the practical way to find problems is to crawl the site and verify that every annotation has its return link. Google's documentation on localized versions is the authoritative reference for syntax. Correct hreflang also settles most duplicate content worries on multilingual sites: translations are not duplicates in the first place, and near-identical regional versions are recognized as alternates.

Related terms

← Back to the glossary