DevKit Tools

Hreflang Tag Generator

Generate hreflang tags as HTML, HTTP headers or sitemap entries, so each language and region version is served to the right visitors.

Technical/Hreflang Tag Generator

Generate the hreflang tags that tell search engines which language and region each version of a page serves.

Language versions

en-ushttps://example.com/
en-gbhttps://example.com/uk/
de-dehttps://example.com/de/
frhttps://example.com/fr/
x-defaulthttps://example.com/

Every listed page must point back at all the others, itself included, or search engines ignore the whole set.

<link rel="alternate" hreflang="en-us" href="https://example.com/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" />
<link rel="alternate" hreflang="de-de" href="https://example.com/de/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

About the hreflang tag generator

Hreflang tells search engines that several pages are the same content in different languages or for different regions, so a visitor in Germany gets the German page rather than the American one. Without it, versions compete with each other and the wrong one often wins.

The rule that catches almost everyone is reciprocity: every page in the set must link to all the others, itself included. If one page is missing a link back, search engines discard the entire set.

How to use it

  1. 1List each language code and its URL, one pair per line.
  2. 2Set an x-default URL for visitors whose language matches nothing.
  3. 3Choose HTML tags, HTTP headers or sitemap entries.
  4. 4Add the output to every page in the set, not just one.

Questions

What format is a language code in?

A two letter ISO 639-1 language, optionally followed by a two letter ISO 3166-1 region: en, en-gb, de-at. A region on its own such as uk is not valid.

Do I need x-default?

It is strongly recommended. It is the fallback for visitors whose language matches none of your versions, and without it search engines pick one themselves.

Does every page need the full set of tags?

Yes, including a tag pointing at itself. Missing reciprocal links are the most common reason hreflang stops working.

Should I use tags, headers or the sitemap?

Any one of the three, not several. HTML tags are simplest for normal pages, headers suit PDFs and other non HTML files, and the sitemap keeps the markup out of your pages entirely.

More SEO & Meta tools