Skip to content

Hreflang Tag Generator

Generate hreflang link tags for every language and region version of a page, with an optional x-default. Checks URL and code format, flags duplicates, previews the entries and exports the tags as HTML.

Web & SEO Runs client-side Free to use
Jump to the tool
Share: X WhatsApp
Loading Hreflang Tag Generator…

About the Hreflang Tag Generator

Hreflang Tag Generator builds the <link rel="alternate" hreflang="…" href="…"> tags that tell search engines which language or regional version of a page to show. Add a row for each version with a language code, an optional region code and the page URL, add an optional x-default URL for users who match none of them, and the tool produces a clean, correctly escaped block of tags ready to paste into the <head> of each page.

Each entry is checked locally: language codes must be 2 or 3 letters, region codes 2 letters, and URLs absolute http or https addresses. Duplicate hreflang values are reported as errors, and one URL used for several hreflang values is flagged for review. These are format checks only — they do not confirm that a code is an official language or region code. Generating tags does not guarantee that search engines will use them: every page in the set must carry the full, reciprocal set of tags, and deploying them is up to the site owner.

How to use

  1. Enter the language code, optional region code and full URL for each version of the page.
  2. Use Add version for more rows and the bin button to remove one.
  3. Optionally enter an x-default URL.
  4. Click Generate tags and review any errors or warnings.
  5. Copy the tags or download them as an .html snippet, then add the same set to every page in the group.

Key features

  • Unlimited language/region rows that you can add, edit and remove.
  • Optional x-default entry.
  • Correctly escaped <link rel="alternate" hreflang> tags.
  • Absolute http/https URL validation and local code-format checks.
  • Duplicate hreflang and duplicate URL detection.
  • Optional preview table, Copy Tags and Download .html.

Best practices

  • Include every version in the set on every page, including a link to the page itself.
  • Make sure the links are reciprocal — if A points to B, B must point back to A.
  • Use the canonical URL of each version, with consistent protocol, host and trailing slashes.
  • Use region codes only when content is truly region-specific, and keep a language-only or x-default fallback.
  • Check each target URL returns the right page before publishing.

Benefits

  • Consistent, correctly formatted tags for every language version.
  • Catches common mistakes such as duplicate codes or relative URLs.
  • A quick preview of the whole set before you deploy.
  • Private: URLs are never visited or uploaded.

Frequently asked questions

What format do the codes use?

A language code of 2 or 3 letters (for example en, fr, hi), optionally followed by a 2-letter region code (for example en-GB or es-MX). The tool writes language in lower case and region in upper case.

Does the tool check that a code is a real language or country?

No. It checks the shape of the code only. Make sure you use ISO 639-1 language codes and ISO 3166-1 alpha-2 region codes — for example the United Kingdom is GB, not UK.

What is x-default?

x-default marks the page to show when no other version matches the user’s language or region, such as a language selector or a global home page. It is optional.

Why is a duplicate URL only a warning?

Several hreflang values can point to the same page if that page genuinely serves all of them, for example one English page for en-GB and en-IE. The tool flags it so you can confirm it is intentional. Duplicate hreflang values, however, are errors.

Where do the tags go?

In the <head> of every page in the set. The same complete block, including each page’s own entry, should appear on all of them. Hreflang can also be provided in HTTP headers or sitemaps, which this tool does not generate.

Will search engines definitely use these tags?

No. Tags are hints. Search engines may ignore them if they are not reciprocal, point to non-canonical or broken URLs, or conflict with other signals.