Hreflang Tag Generator

Generate hreflang tags for a set of language versions, with the return-link and x-default rules that break most implementations.

5Language versions
Yesx-default present

Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.

What the Hreflang Tag Generator does

The hreflang tag generator on this page will generate hreflang tags for a set of language versions, with the return-link and x-default rules that break most implementations. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for setting up hreflang for a multilingual site. More utilities in this area are collected on FreeToolsWorld.org.

How to use it

  1. List every language version, one per line, as a code and an absolute URL.
  2. Add an x-default row pointing at the fallback version.
  3. Pick the output format — sitemap entries are easier to maintain at scale.
  4. Make sure every listed page carries the same complete set, including its own self-reference.

How it works

Hreflang tells search engines which language and regional version of a page to show which users. It is not a ranking signal and does not consolidate signals between versions — it is purely a targeting instruction, and getting it wrong usually means the wrong version ranks rather than nothing ranking.

The reciprocity requirement is where most implementations fail. Every page in a cluster must link to every other page including itself, and the links must agree. If page A claims B is the German version but B does not claim A as the English one, Google ignores the relationship entirely — it does not honour half of it.

The code format is a language code first, optionally followed by a region. "en", "en-GB" and "pt-BR" are valid; "GB" alone and "uk" are not. The single most common error is using a country code where a language is required, and "uk" is particularly bad because it is a valid language code for Ukrainian, not an abbreviation for the United Kingdom.

x-default is for everyone the other values do not match. It usually points at a language selector or at the primary version. Without it, a visitor whose language matches nothing in the cluster gets whichever version Google decides on.

For a large site, the XML sitemap form is far easier to maintain than tags on every page, because the whole cluster is declared in one place rather than duplicated across every version.

When to use it

  • Setting up hreflang for a multilingual site.
  • Generating sitemap hreflang entries for a large cluster.
  • Checking a hreflang implementation for validity.
  • Adding an x-default to an existing cluster.

Common mistakes to avoid

  • Non-reciprocal links, which Google ignores entirely rather than partially.
  • Omitting the self-referencing tag on each page.
  • Using a country code alone, or "uk" for the United Kingdom — that is the code for Ukrainian.

Frequently asked questions

Do hreflang tags need to be reciprocal?

Yes, and this is where most implementations fail. If page A points at B but B does not point back, Google ignores the relationship completely.

What is x-default for?

The version to serve when no listed language matches the user. Usually a language selector or the primary version. Without it, Google picks for you.

Is "uk" the code for the United Kingdom?

No — "uk" is the ISO 639-1 code for Ukrainian. The United Kingdom is the region code GB, as in en-GB.

Related tools

See all seo tools →