Free tool · SEO
Hreflang generator
for stores in several languages and countries.
Enter the language and country versions of a page. The generator checks the codes against Google's rules and creates the hreflang tags as HTML, XML sitemap or HTTP header.
Common mistakes such as en-UK, es-419 or a country without a language are flagged right away, as is a missing general language version.
How hreflang works
Google's rules
With hreflang you tell Google which pages are language or regional versions of the same page. Google can then show searchers the matching version, for example the UK page with prices in pounds instead of the US page.
- Each version lists itself and all other versions. The set of annotations is the same on every version.
- If two pages do not point to each other, Google may ignore the annotation.
- URLs must be fully qualified, with https://. Relative paths such as /en/ do not count. The versions may live on different domains.
- The code is the language per ISO 639-1, optionally followed by the country per ISO 3166-1 alpha-2. Upper or lower case does not matter.
- x-default names the page for everyone whose language has no version of its own.
You can add the annotations as <link> tags in the <head>, as an HTTP header or in the XML sitemap. For Google the three methods are equivalent; one is enough. Each language version also needs its own title and meta description; the meta description checker shows whether they fit in the search result.
Example: one store for the UK, the US and Ireland
Even if all versions are in English, hreflang is worth it as soon as prices, shipping or legal texts differ. Google names exactly this case: small regional differences in the same language.
| Version | hreflang |
|---|---|
| English for all countries without their own version | en |
| United Kingdom | en-GB |
| United States | en-US |
| Ireland | en-IE |
| Language selector or home page | x-default |
If there are only country versions of a language, Google also recommends a general one, such as “en”. This can be one of the existing pages, usually the main English one.
Common mistakes
- en-UK instead of en-GB: UK is not an official country code. According to Google, EU and UN do not work either.
- Country without language: “gb” or “ie” alone does not work, the language always comes first. “uk” on its own is Ukrainian, “be” is Belarusian, not Belgium.
- Numeric regions: codes like es-419 for Latin America are not supported by Google.
- Missing return links: if the English page names the German one but the German page does not name the English one, the annotation does not count.
- Relative URLs: /en/ instead of https://www.example.com/en/.
Hreflang FAQ
What is hreflang?
hreflang is an annotation in the HTML head, the HTTP header or the sitemap that tells search engines which pages are language or regional versions of each other. Google can then show searchers in the UK the UK version instead of the US one.
Does every language version need the tags?
Yes. According to Google, each version must list itself and all other versions. If two pages do not point to each other, Google may ignore the annotation. The set of tags is therefore the same on every version.
Is it en-UK or en-GB?
en-GB. The ISO 3166-1 country code for the United Kingdom is GB. Google says UK, EU and UN do not work because they are not official country codes. Numeric regions such as es-419 are not supported either.
What is x-default for?
x-default names the page for everyone whose language settings match no version. Google recommends it especially for pages with a language or country selector. x-default needs no language code.
HTML, HTTP header or sitemap: which is better?
For Google the three methods are equivalent. Pick one; using all three at once brings no benefit according to Google and is harder to maintain. The HTTP header is mainly meant for files such as PDFs, the sitemap for many pages.
For online stores
Right language, right store. And then?
hreflang brings visitors to the right version. Many of them search the store directly, and when they make a typo the store search often shows nothing. Grumeria is a typo-tolerant site search for online stores. The free feed check shows on your own products what Grumeria finds for such searches; it reads WooCommerce, Shopify, Magento and PrestaShop stores straight from the store address.
- 14-day free trial, no payment method needed
- Then from €29 a month (excl. VAT)
- Free feed check, no account needed