Hreflang Tag Generator

Generate and validate hreflang tags for multilingual and multi-region sites.

Loading tool…

About the Hreflang Tag Generator

Tell Google which language and country each version of your page is for. Add every language version of a page with its URL and the generator builds correct hreflang link tags for your HTML head — or XML sitemap entries — including an x-default fallback.

It checks your work as you go: invalid language or region codes, duplicates, relative URLs and a missing x-default are flagged before they turn into errors in Search Console.

How to use the Hreflang Tag Generator

  1. 1Add a row for each language or regional version of the page.
  2. 2Enter the language code (e.g. en), an optional region (e.g. GB) and the full URL.
  3. 3Set an x-default URL for visitors who don’t match any version.
  4. 4Choose HTML or XML sitemap output and add the same code to every version of the page.

How hreflang works

Hreflang annotations help search engines show the right version of a page to the right audience — the UK English page to searchers in Britain, for example, and the Urdu page to searchers in Pakistan. They also stop translated or regional pages from being treated as duplicate content.

Hreflang rules that are easy to miss

Most hreflang errors come from these mistakes:

  • Every version must list all versions, including itself.
  • Links must be reciprocal — if page A points to B, B must point back to A.
  • Use ISO 639-1 language codes (en, ur, ar) and ISO 3166-1 alpha-2 region codes (US, GB, PK).
  • A region can’t be used on its own: “en-GB” is valid, “GB” is not.
  • Use absolute URLs that return a 200 status and aren’t canonicalized to another page.

Frequently asked questions

What is x-default in hreflang?

x-default tells search engines which page to show when a visitor’s language or region doesn’t match any of your versions — often a language selector or your main page.

Should hreflang go in the HTML or the sitemap?

Both work equally well. HTML tags are simplest for small sites; XML sitemaps are easier to manage when you have many pages and languages. Just don’t maintain conflicting versions in both.

Is “en-UK” a valid hreflang code?

No. The region code for the United Kingdom is GB, so use “en-GB”.

Is Hreflang Tag Generator free to use?

Yes — Hreflang Tag Generator is completely free with no signup, no limits and no hidden costs.

Is my data private and secure?

Everything runs entirely in your browser — your files and text never leave your device, ensuring complete privacy.

Related tools

Explore more free seo tools or browse all 80 tools.