On this page
What the generator produces
This hreflang tag generator takes the language versions of one page, a language code and a full URL for each, and writes the annotations that tell Google which version to show to whom. You get them in the three forms Google supports: link tags for the head of each page, entries for your XML sitemap, and an HTTP Link header for files without a head, such as PDFs. It checks the codes, the URLs, duplicates and the x-default before you copy anything.
It runs in your browser and reads nothing from your site: no request goes to your URLs or to us. The address bar keeps your list, so you can share it with your developer. What hreflang is, in one paragraph, is in our glossary entry on hreflang; how it fits a wider plan for several countries is in international SEO strategy.
How to fill it in
One row per version of the same page, plus an x-default:
| Code | When to use it | Example |
|---|---|---|
| A language only | one version per language, for every country | en, de, fr |
| Language and region | different versions per country in the same language | nl-BE and nl-NL, fr-BE and fr-FR, en-GB and en-US |
| x-default | the page for visitors whose language or country you do not serve, often a language picker or the English version | x-default |
The language is ISO 639-1, two lower-case letters; the region is ISO 3166-1, two upper-case letters. The tool corrects the case and underscores for you. A region never stands alone: "BE" is not a valid hreflang value, "nl-BE" is.
The mistakes it catches
- en-UKThe United Kingdom is GB in ISO 3166-1, so the code is en-GB. en-UK is ignored.
- Relative URLsGoogle needs the full address with https and the domain.
- One code, two URLsEach code may point to one page only.
- Two versions on one URLTwo languages cannot share an address; x-default is the exception, it may point to one of the versions.
- No x-defaultNot an error, but a missed chance to send other visitors somewhere sensible.
- Unknown codesA typo such as "nl-Be" is corrected; a code that does not exist, such as "xx", is flagged.
What the tool cannot check from your input is whether every page really carries the set. Google only trusts a pair when both pages point to each other: if the French page forgets the Dutch one, Google may ignore that pair. Put the same full set on every version, itself included.
Every version lists every version, itself included
The Dutch page, /nl/
nl-BE: itself
fr-BE: annotation present
en: annotation present
x-default: annotation present
The French page, /fr/
nl-BE: annotation present
fr-BE: itself
en: annotation present
x-default: annotation present
The English page, /en/
nl-BE: annotation present
fr-BE: annotation present
en: itself
x-default: the same URL
A broken set: the French page forgot the Dutch one
nl-BE: missing, so Google may ignore the pair
fr-BE: annotation present
en: annotation present
x-default: annotation present
Google only trusts an hreflang pair when both pages point to each other. The generator writes the same full set for every version.
Which format to use
- Head tagssuit most sites: the template writes the set on every page. In Next.js, a static site generator or a theme, generate them from the list of language versions, never by hand per page.
- XML sitemapsuits large sites and shops, where adding tags to every template is hard, or where pages change often. Every URL lists all its versions, so the file grows quickly; split it per section if needed.
- HTTP headeris for files without a head, such as a PDF brochure in three languages.
Use one method per page, not two that might disagree. Google documents all three in its guide to localized versions; Bing relies more on the content-language meta tag and the language of the text itself, so write each version fully in its language.
Hreflang is not a translation
The annotations only point Google to the right version; they do not make a page rank in a country. Each version needs its own search terms, written by someone who knows how people search there: "website laten maken" in Flanders and in the Netherlands use different words around it, and Belgian French differs from French in France. How we set that up for a site in French and Dutch is in a website in French and Dutch, and the whole build on multilingual website development.
Hreflang on Shopify, WooCommerce and custom sites
- Shopifywrites hreflang tags for the languages and markets you set up in Shopify Markets; check the result in the page source, especially after adding a market or a domain.
- WordPress and WooCommercerely on the translation plugin, such as WPML or Polylang, to write the tags; check that every translated page has its counterpart linked, or the plugin leaves pages out.
- A custom site or static exportgenerates the tags from one list of versions in the template. That is how we build: the list drives the URLs, the hreflang, the sitemap and the canonical together.
Whatever the platform, paste the annotations of one page into the generator to check the codes and the x-default.
Checking hreflang after launch
Search Console no longer has a separate report for hreflang, so check it yourself. Open the source of a few pages per language and compare the set; crawl the site with an SEO crawler that reports missing return links; and in Search Console, look at which pages rank in which country to see whether Google shows the right version. When a wrong version shows up, the cause is usually a missing return link or a canonical pointing to the home-language page.
Hreflang questions
Do I need hreflang if my site has only one language?
No. Hreflang only links versions of the same page in different languages or for different countries.
Should a page include itself in its hreflang tags?
Yes. Each version lists every version, itself included, and the set is the same on every page.
Is en-UK a valid hreflang code?
No. The region code for the United Kingdom is GB, so use en-GB.
What should x-default point to?
The page for visitors whose language or country you do not serve: a language picker, or the version most of them can read, often English.