SEO Library Technical SEO 2 min read

Hreflang

In short

Hreflang is an HTML attribute that tells search engines which language and regional version of a page to show to users, so a Hindi speaker in India sees the Hindi page and a UK user sees the en-GB page.

On this page

What is hreflang?#

Hreflang annotations connect equivalent pages in different languages or for different regions. They don’t boost rankings; they help the right version appear for the right audience and reduce duplicate-content confusion between near-identical regional pages.

Syntax#

<link rel="alternate" hreflang="en-in" href="https://example.com/en-in/" />
<link rel="alternate" hreflang="hi-in" href="https://example.com/hi-in/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

Language codes use ISO 639-1 (en, hi, mr) and optional region codes use ISO 3166-1 alpha-2 (IN, GB, US). x-default is the fallback for users who don’t match any listed version.

Rules that trip people up#

  • Return tags are required: if page A references page B, page B must reference page A.
  • Each page should include a self-referencing hreflang.
  • Use canonical URLs only; don’t mix hreflang with canonicals pointing elsewhere.
  • Region-only codes are invalid — in alone means Indonesian language, not India.

Where to implement#

Add hreflang in the HTML head, in HTTP headers (for PDFs), or in your XML sitemap. For WordPress, multilingual plugins such as WPML or Polylang generate the tags automatically.

Avoid automatically redirecting visitors based on IP address; show a language suggestion banner instead so both users and crawlers can reach every version. Related: canonical tag.

Share this term