Hreflang Tag Generator

Hreflang link tags, sitemap entries or HTTP headers, with code validation.

About this tool

List each version of a page on its own line as a language or language-region code followed by its URL, and add x-default for the fallback page. Choose HTML link tags, XML sitemap entries or an HTTP Link header. The tool writes the code and checks every line, flagging country codes used on their own, UK instead of GB, duplicate codes, relative URLs and a missing x-default.

How hreflang works

Hreflang tells search engines which version of a page to show to which language or region. A French searcher should land on the French page and a British one on the en-GB page. Each code is an ISO 639-1 language such as en, fr or de, optionally followed by an ISO 3166-1 region such as en-GB or es-MX. A region alone is invalid, and the United Kingdom is GB, not UK. The x-default value marks the page for everyone else, often a language selector or the international English page. The most important rule is that every version must list every version, including itself, so the same block of tags goes in the head of each page. The XML sitemap format repeats the full set for each URL, which is easier to maintain on large sites. Use absolute URLs that return a 200 status and point their canonical tag at themselves, or search engines may ignore the annotations. Google uses hreflang, while Bing relies more on the content-language meta tag and the page's language. The sitemap generator builds the sitemap, the meta tag generator handles the rest of the head and the robots.txt generator controls crawling. What a URL slug is, and the rules for a clean one covers URL structure.

Frequently asked questions

What is x-default in hreflang?

The page to show users whose language or region doesn't match any listed version, often an international page or a language selector.

Is it en-UK or en-GB?

en-GB. Hreflang uses ISO 3166-1 region codes, and the code for the United Kingdom is GB.

Do hreflang tags need to be on every page?

Yes. Each language version must list all versions, including itself, or search engines may ignore the set.

Is my data saved?

No. Everything runs in your browser and nothing is stored or sent.