Online admissions open for the SEO, web development and networking & cybersecurity courses. Enquire for the next batch.

Hreflang Tags: How to Target Languages and Regions Correctly

5 min read Updated By the SkillNewton team

What is hreflang?

Hreflang is an HTML attribute used in rel="alternate" annotations to tell search engines that several pages are versions of the same content for different languages or regions. Google uses it to show searchers the version that matches their language and location, such as an English page for India and a Hindi page for India, instead of a version meant for another audience.

What hreflang does and does not do

Hreflang helps Google swap the right URL into results. A searcher in India using English might see /en-in/, while a searcher in the United Kingdom sees /en-gb/, even though both pages describe the same product. It is a signal for choosing between alternates, not a ranking boost and not a way to rank a page in a country where it is not relevant.

  • Alternate set: the group of URLs that are language or regional versions of one page.
  • Return tag: the matching annotation on each alternate that points back, confirming the relationship.
  • x-default: the fallback URL for users whose language or region matches none of the listed versions.

Google documents hreflang support in detail. Other search engines may weigh language signals differently, so check their own documentation if they matter for your audience. For the wider strategy behind multi-market sites, read the international SEO guide.

Language and region codes: ISO 639-1 and ISO 3166-1

The hreflang value has a language code and an optional region code, joined by a hyphen. The language comes first and is required. A region on its own is not valid.

ValueMeaningValid?
enEnglish, any regionYes
en-INEnglish for users in IndiaYes
hi-INHindi for users in IndiaYes
ta-INTamil for users in IndiaYes
en-GBEnglish for users in the United KingdomYes
en-UKIntended as UK English, but UK is not the ISO 3166-1 codeNo: use en-GB
INA region with no languageNo
x-defaultFallback for unmatched usersYes

Languages use ISO 639-1 two-letter codes, such as en, hi, bn and mr. Regions use ISO 3166-1 alpha-2 codes, such as IN, GB and AE. Values are not case-sensitive, but writing the region in capitals keeps them easy to read.

Return tags, self-references and x-default

Hreflang annotations must be reciprocal. If the en-IN page lists the hi-IN page as an alternate, the hi-IN page must list the en-IN page too. Without these return tags, Google may ignore the annotations, because anyone could otherwise claim another site's page as their alternate.

Every page in the set should also list itself. In practice you copy the same complete block of annotations into every version, so each page carries the full set, its own URL included.

The x-default value names the page for everyone else. It is often a language selector page or the main international version. It is optional, but useful when your listed versions do not cover every visitor.

Three ways to implement hreflang

Method 1: link elements in the HTML head

This example is for a site with English and Hindi versions for India and an English version for the United Kingdom. The same block goes on all three pages.

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

Method 2: HTTP Link header

For non-HTML files such as PDFs, send the annotations in a Link response header, separated by commas.

Link: <https://example.com/en-in/brochure.pdf>; rel="alternate"; hreflang="en-IN",
      <https://example.com/hi-in/brochure.pdf>; rel="alternate"; hreflang="hi-IN"

Method 3: XML sitemap

Large sites often manage hreflang in the sitemap to keep page templates light. Each url entry lists every alternate, including itself.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/en-in/courses/</loc>
    <xhtml:link rel="alternate" hreflang="en-IN" href="https://example.com/en-in/courses/"/>
    <xhtml:link rel="alternate" hreflang="hi-IN" href="https://example.com/hi-in/courses/"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/courses/"/>
  </url>
  <url>
    <loc>https://example.com/hi-in/courses/</loc>
    <xhtml:link rel="alternate" hreflang="en-IN" href="https://example.com/en-in/courses/"/>
    <xhtml:link rel="alternate" hreflang="hi-IN" href="https://example.com/hi-in/courses/"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/courses/"/>
  </url>
</urlset>

How hreflang interacts with canonical tags

Each language version should have a self-referencing canonical and list only canonical URLs in its hreflang set. Do not canonicalise the Hindi page to the English page: that tells Google the Hindi page is a duplicate, and the hreflang relationship falls apart. Language versions are alternates, not duplicates. The canonical tags guide covers the conflicts that most often appear here.

Two English pages for India and Singapore with almost identical text are a special case. Google may treat them as duplicates and pick one canonical, while hreflang still lets it show the right local URL in results. Adding real local differences, such as currency and contact details, makes the pages more useful.

Checking hreflang step by step

Hreflang errors are silent: the page still loads, and Google simply ignores annotations it cannot trust. Check a new set before relying on it, and recheck after template changes.

  1. View the page source, or the response headers for files, and copy the full annotation block for one page.
  2. Confirm that every value is a valid language code, optionally followed by a valid region code, and that x-default appears at most once.
  3. Open each alternate URL and confirm it returns 200, is indexable, has a self-referencing canonical and carries the same annotation block.
  4. Crawl the section with an SEO crawler that reports hreflang, and filter for missing return tags, non-200 targets and invalid codes.
  5. Use the URL Inspection tool in Search Console on a few alternates to confirm Google has crawled and indexed each version.

If the site generates hreflang from a CMS or plugin, test one page per template rather than every page by hand. Errors usually come from a template, so fixing the template fixes every page that uses it.

Practical exercise: build an hreflang set for three versions

Imagine a training site with an English page for India, a Hindi page for India and a Tamil page for India, plus a global English fallback. Write the full link element block, then write the same set as sitemap entries. Check every code against the ISO lists, confirm each page lists itself, and confirm every alternate URL returns 200 and is not noindexed.

You are done when you can show four identical annotation blocks, one per page, with valid codes, absolute URLs, self-references, an x-default and self-referencing canonicals. Implementing and debugging hreflang on real sites is part of the technical SEO course online.

Common mistakes

  • Putting a country code where the language code belongs, such as hreflang="in" for India, instead of a language plus region such as en-IN.
  • Writing en-UK instead of en-GB.
  • Missing return tags, so the alternates do not confirm each other.
  • Pointing hreflang at URLs that redirect, return errors or carry a canonical to a different page.
  • Automatically redirecting visitors by IP address, which can stop Googlebot from reaching some language versions.

Frequently asked questions

Do I need hreflang if my site is only in English for India?

No. Hreflang is for sites with more than one language or regional version of the same content. A single-version site gains nothing from it.

Can I use hreflang across different domains?

Yes. Alternates can sit on separate domains, such as a .in site and a .co.uk site, as long as every page in the set carries the matching annotations.

Is Search Console's International Targeting report still available?

No. Google retired the International Targeting report in 2022. Check hreflang with page source reviews, crawling tools and the URL Inspection tool instead.

Want to Learn This Properly?

The Technical SEO & Website Optimization (Online) turns guides like this into practised skills, with projects on real websites.

WhatsApp Call Us Now

Free counselling

Send an Enquiry

Tell us which course you are interested in. We reply by email or phone with the next batch and how to enrol.

Protected by reCAPTCHA. Google Privacy and Terms apply.

We reply by email or phone within working hours. No spam.