Free tool

Hreflang Tag Generator (Free Tool)

Hreflang tells a search engine which version of a page belongs to which language and country, so a visitor in Australia does not land on the page written for Nepal. It is also easy to get wrong in ways nothing warns you about. This builder generates the block and checks the parts that usually break.

  • Codes and URLs validated
  • x-default included
  • Nothing is stored

Every version must point at every other one

Hreflang is a set of mutual declarations, not a one-way hint. If the Nepal page lists the Australian page but the Australian page does not list the Nepal page back, the pair is ignored entirely. That is why the block this tool produces is identical on every page in the set, and why each page includes a line pointing at itself.

The practical consequence is that hreflang is maintained per cluster of pages, not per page. Add a market and you edit every page in the group, which is the point at which most sites move the block into a template or a plugin rather than pasting it by hand.

Language, region and x-default

The first part is a language code and it is required. The second part is a country code and it is optional. So en on its own is valid, en-au is valid, and a country on its own is not: au alone means nothing to a search engine. The codes are also not interchangeable with the ones you see elsewhere; the United Kingdom is gb, not uk.

x-default is the version shown to everyone you have not written a page for. On a site serving several English-speaking markets it usually points at the international or global version. Without it, a search engine picks one of your existing versions for that visitor, and it may not be the one you would have chosen.

When hreflang is not the answer

Hreflang solves the problem of near-identical pages written for different markets appearing in the wrong one. It does not solve thin duplication: if the only difference between two pages is a currency symbol, the honest fix is often one page rather than a tag telling search engines to keep both. It also does nothing for pages that are genuinely different, which need no hreflang at all.

If you are deciding between subfolders, subdomains and separate domains for each market, that decision comes before the tags and is much more expensive to change afterwards. That, and the mutual-reference maintenance, is the substance of the international SEO service; the international SEO guide covers the structure choice in more detail.

Frequently asked questions

Do the tags go in the head or the sitemap?

Either works, and you should pick one. Head tags are easier to inspect and to debug in a browser; XML sitemap annotations scale better on large sites and keep page weight down. What you must not do is implement both and let them disagree, because a conflict between the two is resolved unpredictably.

Does hreflang stop duplicate content penalties?

There is no duplicate content penalty to stop. Hreflang tells a search engine that near-identical pages are regional variants of each other rather than competing duplicates, so the right one is shown in each market. It does not consolidate ranking signals the way a canonical does, and the two should not be pointed at each other.

Do I need hreflang for one English site sold in several countries?

Only if you have separate pages per country. One page serving everyone needs no hreflang. Once you publish a page per market with different pricing, contact details or delivery terms, hreflang is what keeps each market on the page written for it.

Ready to talk about your project?

A free 30-minute call, a straight answer about what would move the numbers, and a written proposal within 48 hours if we are a fit.