Hreflang Tag Generator

List the language and regional versions of a page and get a complete, reciprocal set of hreflang annotations as HTML link tags, an HTTP Link header (useful for PDFs) or XML sitemap entries. Every code is checked against the ISO language and country lists, so common mistakes such as en-UK, region-only codes or underscores are caught before they go live.

SEO Runs in your browser

Generate Hreflang Tags

Use an ISO 639-1 language code, optionally followed by a region (en-GB) or script (zh-Hant). Separate the code and URL with a space, tab or comma.
The page shown when no language matches, often a language picker or the global home page.
Output format

How to Use the Hreflang Generator

  1. Enter one version per line: the language code, a space, then the full URL.
  2. Optionally add an x-default URL for visitors whose language does not match any version.
  3. Choose the output format: HTML tags, an HTTP Link header or sitemap entries.
  4. Fix anything listed under Checks, then copy the code into every page of the set (each page must list all versions, including itself).

About This Tool

SEO specialists and developers running multilingual or multi-regional sites, and content teams launching a new country version who need the tags for every page in the set.

Input: Language codes and URLs  ·  Output: HTML, HTTP header or XML sitemap.

Features and Limitations

Features

  • Validates language (ISO 639-1), script (ISO 15924) and region (ISO 3166-1) parts.
  • Suggests fixes for common errors such as en-UK → en-GB and en_US → en-US.
  • Detects duplicate codes, duplicate URLs and relative URLs.
  • Sitemap output repeats the full alternate set inside each <url> entry, as required.
  • Normalises letter case (en-gb becomes en-GB) for readability.

Limitations

  • The tool cannot fetch your pages, so it cannot confirm that every version links back (return tags) or that the URLs are live and canonical.
  • Region codes such as 419 (Latin America) are valid BCP 47 but not supported by Google, so they are flagged as problems.
  • Bing and some other search engines rely more on the content-language meta tag and the page language itself than on hreflang.
  • Results are computed in your browser; nothing you enter is sent to a server.

Example

The line “en-GB https://www.example.com/uk/” becomes <link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/">; adding an x-default URL adds one more tag with hreflang="x-default".

Frequently Asked Questions

Does every page need all the hreflang tags?

Yes. Each page in the set must list every alternate, including itself. If page A points to B but B does not point back to A, search engines may ignore the pair.

Is it en-UK or en-GB?

en-GB. The ISO 3166-1 code for the United Kingdom is GB; UK is not a valid region code, which is one of the most common hreflang mistakes.

What is x-default for?

It names the page to show users whose browser language or location matches none of your versions, such as a global home page or a country selector.

Should I use HTML tags, the HTTP header or a sitemap?

Use one method consistently. HTML tags are simplest, the HTTP Link header works for non-HTML files such as PDFs, and sitemaps keep large sites' templates clean.

Does hreflang change rankings?

It does not boost rankings; it helps search engines show the right language or regional URL to each searcher and reduces duplicate-content confusion between near-identical regional pages.

Related Tools

More like this: all SEO tools, all Developer & Web tools or the TinySandy home page.