Hreflang

Hreflang is an HTML attribute that tells search engines which language and regional version of a page should be shown to users in different countries or language settings. It helps Google understand that similar pages are intended for different audiences, such as English for the US, English for the UK, or Spanish for Mexico.

Why hreflang matters for SEO

Hreflang matters because international and multilingual websites often publish very similar content across multiple versions of a page. Without clear signals, search engines may rank the wrong version in the wrong market, split ranking signals across duplicates, or show users a page with the wrong currency, spelling, or offer details.

For growing brands, this affects organic traffic, conversion rates, and user experience. If a user in Canada lands on a US product page instead of the Canadian version, they may see the wrong pricing or shipping information. Hreflang helps search engines serve the most relevant version while keeping each page eligible to rank in its target market.

How hreflang works

Each language or regional page references its alternate versions using hreflang annotations. These can be placed in the HTML head, in XML sitemaps, or in HTTP headers for non-HTML files.

Common hreflang values

Language codes use ISO language formats such as en for English or es for Spanish. Regional targeting adds a country code, such as en-us, en-gb, or fr-ca. A page can also use x-default for a fallback version when no better match exists.

Practical example

If your site has three versions of the same service page, one for US English, one for UK English, and one for Spanish-speaking users in Mexico, each page should reference all three alternates. That tells search engines these pages are connected, not duplicates competing against each other.

For example, your US page would point to en-us, your UK page to en-gb, and your Mexico page to es-mx. If you also have a global selector page, you could mark it as x-default.

Hreflang best practices

Use hreflang only when pages are true equivalents for different audiences. Keep annotations reciprocal, meaning if Page A points to Page B, Page B should point back to Page A. Include a self-referencing hreflang tag on each page, and make sure the language and country codes are valid.

Match hreflang targets to canonical tags carefully. Usually, each localized page should have a self-referencing canonical, not all versions pointing to one master page. Also check that localized pages are indexable, return a 200 status code, and are not blocked by robots directives.

For beginner SEO teams, XML sitemap implementation is often easier to manage at scale than editing page templates one by one. This is especially useful for ecommerce catalogs, SaaS landing pages, and multi-country service sites.

Need a place to start?

Begin with the fundamentals, then work through the topics that shape real search visibility.

Start Here

Build stronger SEO understanding
one lesson at a time

Get clear explanations, structured learning, and practical guidance that helps you make better SEO decisions with more confidence.