Skip to main content
Premier SEO Services

SEO tools

Hreflang Tags Generator

Generate hreflang annotations for every language and region version of a page, including x-default, as HTML link tags, XML sitemap entries or HTTP Link headers, with the codes checked as you type.

  • Runs in your browser
  • Free, no sign-up
  • Unlimited use
  • Updated 30 September 2026

Hreflang Tags Generator

Set the options, then copy or download the result

How to use the hreflang tags generator

  1. 1Enter a Code and URL for every language or region version, including the page you're on. Use Add language for more rows.
  2. 2Keep the x-default row and point it at the page for everyone else (often the homepage or a language picker).
  3. 3Fix anything flagged under a row, such as en-UK or en_US.
  4. 4Choose the Output format and press Copy or Download. Add the same set to every version.

Example: English, UK English and German

Input
en → https://www.example.com/
en-GB → https://www.example.com/uk/
de → https://www.example.com/de/
x-default → https://www.example.com/
Output
<link rel="alternate" hreflang="en" href="https://www.example.com/">
<link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/">
<link rel="alternate" hreflang="de" href="https://www.example.com/de/">
<link rel="alternate" hreflang="x-default" href="https://www.example.com/">

Typing en-UK instead shows: “UK isn't an ISO 3166-1 country code. Use en-GB.” Codes are normalized, so en-gb becomes en-GB.

Language and region codes

An hreflang value is a language, optionally followed by a region: de (German, anywhere), de-AT (German for Austria), zh-Hant-TW (Traditional Chinese for Taiwan). The language must be a two-letter ISO 639-1 code and the region a two-letter ISO 3166-1 country code. A region on its own (GB) isn't valid. The generator checks both parts and shows the language and country names so you can spot typos.

Hreflang works only as a complete, two-way set. If the English page says the German page is its de version, the German page must link back to the English page, and each page must also list itself. When the links don't match, search engines ignore the annotations for those pages. In practice: generate the set once, then put the identical block on every version.

x-default explained

x-default tells search engines which URL to show to searchers whose language or region doesn't match any version you list. It's usually the homepage that redirects by language, a language picker, or your main international version. It isn't required, but without it, someone searching in Italian on a site with only English and German may land on either one.

HTML vs sitemap vs HTTP header

MethodBest forNotes
<link> tags in <head>Small and medium sitesAdds a few lines to every page
XML sitemapLarge sites, many languagesKeeps page HTML small; each <url> lists all versions
HTTP Link headerPDFs and other non-HTML filesNeeds server configuration

Use one method per page. Mixing them is allowed but makes mistakes harder to find.

Common hreflang mistakes

  • Wrong codes: en-UK (should be en-GB), en_US (underscore), es-LA (no such country), or region numbers such as es-419, which Google doesn't support.
  • Missing return links or missing self-references.
  • Pointing to redirects or non-canonical URLs: each URL should return 200 and be the canonical version.
  • Relative URLs: hreflang needs absolute URLs.
  • One code, two URLs: each code may appear once per set.

Is anything I enter stored?

This tool runs entirely in your browser. Your text is not uploaded to our servers.

Sources

Questions about the hreflang tags generator

Do hreflang pages need to link back to each other?

Yes. Each version must list all versions, including itself. If page A points to B but B doesn't point back to A, the annotation is ignored.

Is en-UK a valid code?

No. The ISO 3166-1 code for the United Kingdom is GB, so use en-GB. UK is reserved but not assigned as a country code.

Does hreflang replace canonical tags?

No, they work together. Each language version should have a self-referencing canonical; don't point all versions' canonicals at one language, or the others may drop out of the index.

Learn more

Last updated 30 September 2026Maintained by Premier SEO Services

Report a problem