Hreflang Tags: Run a Hindi and English Site the Right Way
By Neha
A coaching institute in Lucknow pays for a Hindi version of its website. The translation is good, the pages are live, and three months later a parent searching in Hindi still lands on the English admissions page. A furniture exporter in Jodhpur builds one page for buyers in the UK and one for buyers in the US, with prices in pounds and dollars, and Google keeps showing the dollar page to people in London.
In both cases the pages exist. What is missing is a small label telling Google which page is meant for whom. That label is called hreflang, and this guide explains hreflang tags without the jargon: what they do, whether you need them, how to write them, and the mistakes that make Google ignore them.
What hreflang tags are
An hreflang tag is one line of code in a page that says: "this same page is also available in another language, or for another country, at this address".
The name is short for "hypertext reference language". You can forget that immediately. What matters is the job. When Google knows that two pages are the same content for different audiences, it shows each searcher the version that suits them. The Hindi searcher gets the Hindi page. The buyer in London gets the page in pounds.
Hreflang does not translate anything, and it does not lift your rankings on its own. It only swaps one of your pages for a better-suited one of your pages.
Do you need them?
Most small business websites do not. Check yourself against this list.
You need hreflang if:
- Your website has the same pages in two or more languages, such as English and Hindi, or English and Tamil.
- You have separate versions of pages for different countries, even in the same language, such as India, the UAE and the UK with different prices or phone numbers.
You do not need hreflang if:
- Your site is in one language for one country.
- You have a single page that mixes languages, for example Hindi headings with English text. There is only one page, so there is nothing to choose between.
- You use an automatic translate button that changes the text without changing the address. Google sees only the original page.
That last point surprises people. For Google to show a Hindi page, the Hindi version must live at its own address, such as yoursite.in/hi/admissions. A translate widget is a convenience for visitors, not a second version of your site.
What a tag looks like
Here is the full set of tags for a page that exists in English and Hindi:
<link rel="alternate" hreflang="en-in" href="https://example.in/admissions" />
<link rel="alternate" hreflang="hi-in" href="https://example.in/hi/admissions" />
<link rel="alternate" hreflang="x-default" href="https://example.in/admissions" />
Reading one line from left to right:
rel="alternate"says "this is another version of the page".hreflang="hi-in"says who it is for: Hindi speakers, in India.hrefis the full address of that version.
These lines sit in the head section of the page, the hidden part at the top that visitors never see. The same three lines go on both the English page and the Hindi page.
Language codes and country codes
The code has two parts. The first is the language, and it is required. The second is the country, and it is optional.
| Code | Meaning |
|---|---|
hi | Hindi, anywhere in the world |
hi-in | Hindi, for people in India |
en-in | English, for people in India |
en-gb | English, for people in the United Kingdom |
en-ae | English, for people in the UAE |
ta | Tamil |
bn | Bengali |
mr | Marathi |
Some codes are not what you would guess, and a wrong code is silently ignored:
- The United Kingdom is
gb, notuk. - A country on its own is not allowed.
inby itself does not mean India; Google reads the first part as a language. - There is no code for "Europe" or "the Gulf". You list each country.
If your only goal is "Hindi page for Hindi readers", use the plain language code hi and skip the country. Add a country only when you truly have different pages for different countries.
Hindi written in English letters, often called Hinglish, has no simple code of its own. If you publish such pages, treat them as Hindi and ask your developer about the script code hi-Latn. For most small sites this is not worth the effort.
The three rules that make hreflang work
Nearly every hreflang problem comes from breaking one of these.
1. Tags must point both ways
If the English page says "my Hindi version is over there", the Hindi page must say "my English version is over there". Google checks both sides. If only one page makes the claim, Google does not trust it and ignores the pair.
2. Each page lists itself
The English page includes a line for the English page. It looks odd, but it is expected. The simplest way to get this right is to put the identical block of lines on every version.
3. Addresses must be complete and working
Write the full address starting with https://. The address must open a real page, not an error, not a redirect, and not a page blocked from Google. If you recently moved to https or dropped the www, update the tags too.
What x-default means
The line marked x-default is the fallback. It tells Google which version to show people who match none of your languages, such as a French speaker finding your English and Hindi site.
For most Indian businesses the fallback is the English page. It is optional, but it takes one line and removes guesswork.
Three places to put the tags
You only need one of these.
- In the page itself. The lines shown above, in the head of every page. Best for small sites.
- In the XML sitemap. Each address in the sitemap lists its other versions. Easier to maintain on large sites, since everything is in one file. See our XML sitemap guide.
- In the HTTP headers. Only needed for files that are not web pages, such as PDFs.
On WordPress, translation plugins such as Polylang, WPML and TranslatePress add the tags for you once each page is linked to its translation. Shopify adds them automatically when you publish more than one language or market. On these platforms your job is to check the result, not to write the code.
If you are writing them by hand, the hreflang tag generator builds the block for you, ready to paste.
Hreflang and canonical tags
A canonical tag tells Google "this is the main address for this content". It is easy to set one that fights with your hreflang tags.
The rule: each language version should name itself as canonical. The Hindi page's canonical is the Hindi page. If the Hindi page's canonical points to the English page, you are telling Google "ignore this page, the real one is in English", and the Hindi version drops out of search.
Our guide to canonical tags and duplicate content explains the canonical side, and the canonical checker shows what any page currently declares.
Common mistakes
- Translating the home page only. Tags that pair a Hindi home page with fifty English inner pages help nobody. Pair page with page: admissions with admissions, fees with fees.
- Pointing every page at the other language's home page. Each tag should lead to the matching page, not the front door.
- Using the wrong code.
en-uk,hin,INon its own. Check each code against the table above. - Machine-translated pages nobody has read. Hreflang will dutifully send Hindi readers to a page full of awkward text. Have a native speaker read it first.
- Redirecting visitors by location automatically. Forcing everyone in India to the Hindi page can also trap Google's crawler, which mostly visits from the United States. Let people choose, with a visible language switch.
- Forgetting new pages. A page added in English six months later has no pair until someone adds it.
How to check your tags
- Open the hreflang checker and enter a page that has a translation. It reads the tags and flags invalid codes and missing entries.
- Repeat for the other language version of the same page, and confirm each one names the other.
- If you use the sitemap method, run the sitemap checker to confirm the sitemap itself can be read.
- In Google Search Console, use URL Inspection on the Hindi page and confirm it is indexed and that its chosen canonical is itself.
Google takes a few weeks to re-read both pages and act on the pairing. A page that is not indexed at all cannot be swapped in, so fix that first with our guide to getting your website on Google.
Frequently asked questions
Do hreflang tags improve rankings?
Not directly. They help the right version appear for the right person, which usually improves clicks and enquiries because people land on a page they can read.
Does Google use the lang attribute in my HTML?
No. The lang attribute at the top of a page helps screen readers and browsers. Google works out the language from the visible text and uses hreflang to connect versions.
Will a Hindi version count as duplicate content?
No. A translation is different content for a different audience. Two English pages for India and the UK with nearly the same text are closer to duplicates, and hreflang is exactly how you tell Google they are deliberate.
Should the Hindi pages be on a separate domain?
They do not need to be. A folder such as /hi/ on your existing domain is the cheapest to run and keeps all your site's reputation in one place.
