What hreflang does
hreflang is a small piece of code that tells Google "this page also exists in these languages or for these countries, and here is each URL". Google then shows searchers the version that fits them.
Without it, an Indian visitor might land on your US page with dollar prices, or Google might treat your UK and Australian English pages as duplicates and pick one to show everywhere. hreflang doesn't make a page rank higher. It makes sure the right version shows up where you already rank.
Each code is a language (ISO 639-1, two letters, like en or hi), optionally followed by a country (ISO 3166-1, two letters, like IN or GB). The special value x-default marks the page for everyone who matches none of your versions.
The rule most sites break: it must be reciprocal
Every version has to list every other version and itself. If your UK page points to your US page, the US page must point back to the UK page, and both must include a line pointing to themselves. When the return link is missing, Google can ignore the pair. That's why this tool gives you one complete set: paste the same set on every version listed in it.
How to use the code
- HTML tags are the simplest for small sites. Every version carries the full set in its head.
- XML sitemap entries suit large sites, because you don't have to touch page templates. Each URL gets its own block listing all alternates.
- HTTP headers are for files like PDFs that have no HTML head.
Pick one method and stick to it. Using two is allowed, but they drift apart over time, and conflicting signals are harder to debug than missing ones.
Mistakes this tool catches
- en-UK. The United Kingdom's code is GB, so it's en-GB. "UK" is not a valid country code, and "uk" on its own means Ukrainian.
- A country with no language. hreflang="IN" doesn't work. It must be en-IN, hi-IN and so on.
- Wrong language codes. jp for Japanese (it's ja), cn for Chinese (zh), kr for Korean (ko).
- Duplicates. Two URLs for the same language and country confuse Google.
- Relative URLs. hreflang needs the full address with https://.
It can't check your live pages, so it can't confirm the return links exist, that each URL returns a 200 status, or that it isn't redirected or blocked by a noindex or a canonical pointing elsewhere. Those checks need a crawl.
hreflang in practice: Disney+ Hotstar
At Disney+ Hotstar I worked on international SEO, including hreflang, so the diaspora audience in the USA, Canada and Europe found the right version of the service in search. You can read about that work in the Disney+ Hotstar case study. My international SEO page covers how I plan country and language versions, and if you're moving those versions to new URLs, read how I approach site migrations first, because a move is when hreflang sets most often break.