Hreflang is an HTML attribute that tells search engines which language and regional version of a page to show users, when you have multiple versions of the same content targeting different countries or languages.
Why it’s needed: Without hreflang, search engines might show a French user your English-language page even though a French version exists, or worse, treat your different language versions as duplicate content competing against each other.
Basic implementation: Hreflang tags go in the <head> of each page, and every language/region version needs to reference itself and every other version — including a “return tag” pointing back. For example, an English US page needs a link to its Spanish version, and that Spanish version needs a corresponding link back to the English page, plus a self-referencing tag.
<link rel="alternate" hreflang="en-us" href="https://example.com/us/" />
<link rel="alternate" hreflang="es-mx" href="https://example.com/mx/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
The x-default tag specifies a fallback version for users whose language/region doesn’t match any of your specified options.
Common mistakes: Missing return tags (Page A links to Page B, but B doesn’t link back), using incorrect language/country codes, and forgetting to update hreflang tags when a page URL changes.
How to validate: A crawler such as Screaming Frog flags missing return tags and invalid codes (Search Console's International Targeting report was retired in 2022), and third-party tools like Merkle’s hreflang tag generator help catch syntax mistakes before publishing.
Three ways to add hreflang
- HTML link tags in the head (shown above): simplest for most sites, but adds weight to every page when you have many languages.
- HTTP headers: useful for non-HTML files such as PDFs.
- XML sitemap: each
<url>entry lists its alternates with<xhtml:link>elements. This keeps the HTML clean and is easiest to manage on large sites.
Use only one method per page set. Mixing methods makes errors harder to find.
Language and region codes
The value is a language code (ISO 639-1), optionally followed by a region code (ISO 3166-1 Alpha-2):
hi: Hindi for all regions.en-in: English for users in India.en-gb: English for the United Kingdom. Note it'sgb, notuk.ta-in,te-in,mr-in: Tamil, Telugu and Marathi for India.
You cannot use a region on its own (in is the code for Indonesian, not India). Using the wrong code is one of the most common reasons hreflang is ignored.
Hreflang for Indian language sites
Many Indian publishers and brands now run Hindi and regional-language editions alongside English. Give each language its own URL (for example /hi/ and /ta/ folders), translate the full page rather than just the menu, and connect the versions with hreflang. This helps Google show the Tamil article to a Tamil-language user instead of the English one. If you publish for Google Discover in Tamil, Telugu and Marathi, correct hreflang is part of the foundation.
Hreflang and canonical tags together
Each language version should have a self-referencing canonical tag. Don't canonicalise all language versions to the English page. That tells Google the translations are duplicates and they will drop out of the index. Hreflang should only point to canonical, indexable URLs that return 200.
How to validate hreflang today
Search Console's International Targeting report was retired in 2022, so you need other ways to check your setup:
- Crawl the site with a tool that audits hreflang (Screaming Frog, Sitebulb or similar). It will flag missing return tags, non-200 targets and invalid codes.
- Use URL Inspection in Search Console to confirm each language version is indexed and Google has chosen it as canonical.
- In the Performance report, filter by country and by page to check that each market receives impressions on the right language version.
When you don't need hreflang
If you have only one language and one market, hreflang adds nothing. It also isn't needed for content that is different in each language, such as unrelated blog posts. Use it only when the same page exists in several language or regional versions.
