Free tool · runs in your browser

Build hreflang tags without the typos

List each language or country version of a page and its URL. You get the tags as HTML, as XML sitemap entries or as HTTP headers, with the common code mistakes caught before they go live. Nothing you type is sent anywhere.

Add one row per version of the same page. Pick a language, add a country only if that version targets one, and paste the full URL. Not in the list? Choose "Other code..." and type it.

1. Versions of this page

0 versions ready.

  • Row 1 (en-IN): add the URL.
  • Row 2 (en-US): add the URL.
  • Row 3 (x-default): add the URL.
  • Every version listed here must carry this same full set of tags, including a line pointing to itself. If page A lists page B but B doesn't list A, Google can ignore both.
2. Choose a format
3. Copy the code
Fill in at least one complete row to see the code.
HTML tags go in the <head> of every version. Sitemap entries list each URL once with all its alternates. HTTP headers suit PDFs and other files without HTML.

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.

FAQ

Questions about hreflang

Do I need hreflang if my site is in one language?

No. hreflang is only for pages that exist in more than one language or for more than one country. A site with one English version for everyone doesn't need it. You need it when, say, you have separate pages for India and the US, even if both are in English.

What is x-default and do I need it?

x-default names the page Google should show people who match none of your versions, often a language picker or your main international page. It's optional but useful. Without it, Google picks a version on its own for those visitors, which may not be the one you'd choose.

Should hreflang URLs match the canonical tag?

Yes. Each URL in your hreflang set should be the canonical version of that page, and each page's canonical should point to itself, not to another language version. If the Indian page's canonical points to the US page, Google treats it as a duplicate and the hreflang set breaks.

Does Bing use hreflang?

Bing has historically leaned on the content-language meta tag or HTTP header, plus signals like the page's language and location, more than on hreflang. If Bing matters in your markets, add a content-language tag alongside hreflang. It takes a minute and covers both engines.

How long does Google take to pick up hreflang changes?

Google has to recrawl every version in the set before the changes count, so it can take from a few days to several weeks on a large site. Listing the URLs in an XML sitemap helps them get recrawled. Search Console no longer has a dedicated hreflang report, so spot-check results for your target countries.

Working on a hard search problem?

I enjoy a tough SEO or GEO challenge, so tell me about yours. I'm also happy to speak at events and join podcasts.

Say hello →