Account

What new tool do you want?

Web & SEO

Hreflang Tag Generator

Generate hreflang link tags (and the x-default) for multilingual or multi-regional sites, as HTML <link> tags or XML sitemap entries.

How to use

  1. 1List each version as 'language-code URL' (e.g. 'en-us https://example.com/').
  2. 2Choose the x-default URL and the output format, then add the tags to every version of the page.

How it's calculated

Each page version lists all versions, including itself. Codes are ISO 639-1 language codes, optionally with an ISO 3166-1 region (en-GB). x-default marks the fallback page.

Frequently asked questions

Does every page need the full set?

Yes — hreflang must be reciprocal: each version lists every other version and itself, or Google may ignore it.

Is it en-uk or en-gb?

en-gb — region codes follow ISO 3166-1, where the United Kingdom is GB.

What is x-default?

The page shown when no language matches the user, often a language selector or your main international page.

Why the exact same tag set has to go on every single page version

Hreflang only works as a reciprocal set — Google's own guidance states that if page A lists page B as an alternate but B doesn't list A back, the relationship can be ignored entirely. That's why this generator produces one identical block of tags meant to be pasted onto every version of the page, including itself in the list each time — the en-US page, the en-GB page and the German page should all carry the exact same set of <link> tags, not a version tailored to 'other pages relative to me.'

Worked example: Hreflang Tag Generator

Entering 'en-us https://x.io/' and 'de https://x.io/de/' with an x-default of https://x.io/ produces three tags: one for en-us pointing to the English URL, one for de pointing to the German URL, and one for x-default pointing to the same English URL as the fallback — meant to be pasted identically onto both the English and German pages. Try entering 'en-uk https://x.io/uk/' instead of the correct code, and the generator rejects it outright with an error pointing to en-gb — catching a mistake that's common specifically because 'UK' is the everyday abbreviation but ISO 3166-1 uses GB for the United Kingdom.

Why x-default isn't automatically one of your listed languages

x-default is a distinct hreflang value, not a regular language code, and it marks whichever page should be shown to a visitor whose language doesn't match any of the versions you've listed — often a language-selector page or a default international site rather than any specific localized version. Treating it as optional and leaving it out means search engines showing international results have no instruction for visitors outside your explicitly covered languages, who'd otherwise land on whichever version Google guesses is closest.

Why HTML link tags and sitemap entries are two different delivery methods for the same information

The same hreflang relationships can be declared either as <link> tags in each page's <head>, or as <xhtml:link> entries inside an XML sitemap — functionally equivalent to search engines, but practically very different to maintain: HTML tags need to be edited per page whenever the page set changes, while sitemap entries centralize every page's hreflang relationships in one file. Large multilingual sites often prefer the sitemap approach specifically because it avoids editing hundreds of individual page templates every time a new language version launches.

Related tools

More: Web & SEO