What is hreflang and when should you use it?

Short answer
Hreflang is an HTML attribute (or HTTP header / sitemap tag) that tells search engines which language and region each version of a page targets. For example, hreflang='en-gb' signals the British English version and hreflang='fr' signals the French version. Google uses it to show the right language version to users in the right country, preventing duplicate content issues across international versions of the same site.

Hreflang was introduced by Google in 2011 to help sites serving the same content in multiple languages or regional variants rank the correct page for the correct audience. Without it, Google may index your American English page for British users, or rank your French-language product page in German search results - both of which result in poor user experience and wasted ranking potential.

The implementation has three placement options: in the HTML head as link rel="alternate" tags, in the HTTP response headers (useful for non-HTML files like PDFs), or in your XML sitemap. The sitemap approach is usually easiest to manage at scale. Whichever method you choose, every version must include a self-referential hreflang tag as well as a tag pointing to every other language or regional variant - including an x-default fallback for users who match none of the specified locales.

Common hreflang mistakes include one-sided implementations (page A references page B but page B does not reference page A), missing x-default tags, and incorrect ISO language or country codes (it's "en-GB" not "en-uk"). These errors cause Google to ignore the entire hreflang set for those pages.

Use hreflang when you have the same or substantially similar content in multiple languages, or when you serve the same language to meaningfully different regional audiences with distinct URLs (e.g., US and UK pricing pages in English). If your content is identical and the URL difference is only cosmetic, a single canonical is often cleaner than hreflang.

Try the tool

Hreflang Generator
Reviewed by Rameez Majeed · Last reviewed