SEO glossaryHreflang is an HTML attribute that tells search engines which language or region each version of a page is for, so they show the right one.
Hreflang is an annotation that links the different language and regional versions of the same page together, so a search engine can show each searcher the version meant for them: the Spanish page to Spanish speakers, the UK page with prices in pounds to searchers in the UK, the US page to searchers in the US. It does not boost rankings. It swaps the right version into the result where the site already ranks.
Google and Yandex support hreflang. Bing has historically recommended the content-language meta tag rather than hreflang, so multilingual sites often set it, and the lang attribute, as well.
How it is written
Each version lists every version, including itself, with a language code and an optional region code:
<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
- The language is an ISO 639-1 code, such as
en,es, orde. - The optional region is an ISO 3166-1 alpha-2 country code, such as
us,gb, ormx. A region can never be used on its own. x-defaultmarks the fallback page for anyone who matches none of the listed versions, often a language selector or the main international page.
The same annotations can be placed in the HTML head, in HTTP headers (useful for PDFs), or in the XML sitemap. Pick one method and use it consistently.
When to use it
- The same content is translated into several languages.
- The same language is targeted at different regions with differences in currency, spelling, shipping, or contact details, such as US and UK English.
- The versions sit on one domain, on subdomains, on subfolders, or across separate country domains; hreflang works across all of them.
A site in one language for one market does not need hreflang.
Hreflang in WordPress
Multilingual plugins such as WPML, Polylang, and TranslatePress generate hreflang tags automatically for each translation they manage, and WordPress multisite setups can use a plugin that connects translations across sites. Check the output after setup: view the page source and confirm every version is listed, uses the right codes, and points to live URLs.
Common mistakes
- Missing return links. If page A lists page B but B does not list A, Google may ignore the pair. Annotations must be reciprocal.
- Invalid codes.
en-ukis wrong (the code for the United Kingdom isgb), and a region alone, such ashreflang="us", is invalid. - Pointing to non-canonical URLs. Every URL in a hreflang set should return a 200 status, be indexable, and be its own canonical. Canonicalizing translations to the original language undoes the whole setup; see canonicalization.
- Relative URLs. Hreflang needs full absolute URLs, including
https://. - Forgetting maintenance. When a page is deleted, moved, or redirected, update the annotations on every other version.
Search Console no longer has a dedicated international targeting report, so audit hreflang with a site crawler that validates return links and codes, and check the pages that should rank in each market using Google's country and language settings.
Source: Google Search Central, tell Google about localized versions of your page.