What is hreflang?

hreflang is an attribute that tells search engines which language and regional version of a page to show to which users.

hreflang is an HTML attribute (also expressible in HTTP headers and sitemaps) that specifies the language and, optionally, the geographic region a page is intended for. It solves a specific problem for multilingual and multiregional sites: telling search engines that several URLs are equivalent versions of the same content in different languages, so the right version is served to the right audience.

The attribute value combines a language code with an optional region code — for example en for English, en-GB for British English, es-MX for Mexican Spanish. A special value, x-default, marks the fallback page for users whose language or region does not match any specified version. Getting these codes right is essential; invalid or mismatched codes cause search engines to ignore the annotations.

The most important and often-missed rule of hreflang is reciprocity: every page in a set must reference every other page, including itself. If the English page links to the French version with hreflang, the French page must link back to the English version. Missing return links are the single most common hreflang error and cause the annotations to be disregarded.

Correct hreflang implementation improves user experience and prevents self-competition. Without it, search engines might show German users an English page, or treat regional variants as duplicate content competing against each other. With it, each market sees the appropriate version, and ranking signals are shared across the language set rather than diluted. Generating and auditing hreflang tags carefully avoids costly mistakes on large international sites.

Examples

  • <link rel="alternate" hreflang="en-GB" href="https://example.com/gb/" />
  • <link rel="alternate" hreflang="x-default" href="https://example.com/" />
  • A three-language set where en, fr, and de pages all reference each other

Frequently asked questions

Free tools for working with hreflang

Related terms