Free SEO audit with 10 action points - $2K worth of value
Rasesh Koirala

Hreflang Tag Generator

Build correct hreflang alternate tags with x-default, and a reminder about the return tags most setups get wrong.

hreflang.html

How to use it

  1. List each version as language-REGION | URL, one per line - for example en-AU | https://example.com/. Language only (en) is fine too.
  2. Add an x-default URL for visitors whose language you do not target.
  3. Copy the full block of tags.
  4. Paste the same complete block into the <head> of every page in the group - each page must reference all versions, including itself.

What it does, and what it does not

It does: build correct rel="alternate" hreflang link tags, normalise your codes (lowercase language, uppercase region), add x-default, and warn about invalid codes, non-absolute URLs and duplicates.

It does not: add the tags to your pages or verify the return links exist. Hreflang only works when every page in the set links back to every other, and that is on you to deploy.

Reference

Hreflang tells Google which language and regional version of a page to show which users. Done right, an Australian searcher gets your en-AU page and a British searcher gets en-GB, instead of Google guessing. It is not a ranking factor; it is a targeting and duplicate-content signal that keeps your regional pages from competing with each other.

The value is a language code, optionally followed by a region: en, or en-AU. The language is an ISO 639-1 code and the region an ISO 3166-1 country code - and note the region is a country, not a continent or language, so English for Australia is en-AU, not en-EU. Add a special x-default entry pointing at the page to serve when no listed language fits; it is where you send everyone else.

The rule that breaks most hreflang setups is return tags. Hreflang must be reciprocal: if your English page lists the German page, the German page must list the English page back, and every page in the cluster must also list itself. Miss a return link and Google discards the whole set. That is why this tool outputs the complete block for you to place on every page - the set is identical on all of them. The URLs must be absolute, and each should point at the canonical, indexable version of that page, not a redirect. You can place these tags in the HTML head, and that is the simplest way; larger sites sometimes use the XML sitemap or HTTP headers instead. Whichever you choose, be consistent and deploy the full reciprocal set, then check coverage over time in Search Console.

Questions

Do I put these on every page?

Yes. The full block goes in the <head> of every page in the language group, and each page must include a tag for itself. If the return links are not reciprocal, Google ignores the set.

What is x-default for?

It is the fallback shown to users whose language or region you do not specifically target - often a language selector page or your main version.

Is the region a country or a continent?

A country. The region code is ISO 3166-1, so Australian English is en-AU. There is no valid en-EU.

Does hreflang boost rankings?

No. It is a targeting signal that serves the right regional version and prevents your versions from being treated as duplicates. That protects performance rather than boosting it.

Can I use a sitemap instead of head tags?

Yes, hreflang can go in the XML sitemap or HTTP headers. Head tags are the simplest for most sites. Whichever you pick, keep it consistent and reciprocal.

Related tools

Built by , SEO consultant and trainer in Sydney. Found a bug or want a tool added? Tell me.