Hreflang Tag Generator - International SEO

Generate valid hreflang link tags for multilingual websites, including the x-default fallback and the XML sitemap variant. With duplicate and URL validation. Free, in your browser.

Generate correct hreflang tags for multilingual sites

This generator builds the full set of link rel="alternate" hreflang tags for a multilingual or multi-regional page. Pick a language from the dropdown, optionally add a two-letter region code, paste the URL for each version, and toggle the x-default fallback. The output is available both as HTML head tags and as the xhtml:link variant used inside XML sitemaps.

Hreflang tells Google and Yandex which language and regional version of a page to show each searcher. International e-commerce stores use it to send German shoppers to the de-DE catalog with euro prices, SaaS companies use it to separate en-US and en-GB spellings, and publishers use it to keep translated articles from competing against each other in the same results page.

The generator validates as you type: it flags duplicate locales, warns when a URL is relative instead of absolute, and checks that region codes are valid two-letter ISO 3166-1 format. It also reminds you of the most common hreflang failure: annotations must be reciprocal, so every listed URL needs the identical tag set pointing back, or search engines discard the whole cluster.

For large sites, the sitemap variant is usually the better home for hreflang because it keeps page HTML lean; a site with 20 languages would otherwise carry 21 link tags on every page, including the self-reference. The x-default entry catches visitors whose language matches none of your versions, typically pointing at your global or English page.

Hreflang works best alongside solid on-page metadata. Generate titles and descriptions per language with the Meta Tag Generator, and preview how each version appears in results with the SERP Snippet Preview, both free on ToolForte. Like this generator, they run entirely in your browser, so you can prepare a full international rollout, tags, titles, and snippets included, without sending unpublished URLs to any external service.

How the Hreflang Generator Works

  1. 01Add a row per language version: pick the language code, optionally add a two-letter region, and paste that version's absolute URL.
  2. 02Toggle x-default on and set the fallback URL for visitors whose language matches none of your versions.
  3. 03The tool validates for duplicate locales, relative URLs, and malformed region codes as you type.
  4. 04Copy the output as HTML head tags or switch tabs for the xhtml:link block used in XML sitemaps.

Implementing Hreflang Without the Classic Mistakes

Hreflang fails silently, so precision matters. The three rules that prevent most failures: use absolute URLs, make annotations reciprocal, and include a self-reference. Reciprocal means that if your English page lists the German version, the German page must carry the identical tag set pointing back, including a tag referencing itself; search engines that find a one-way annotation discard the entire cluster. Codes must be ISO 639-1 for language and ISO 3166-1 alpha-2 for region, in the language-REGION order like en-GB, and a region can never stand alone. Choose one of three placements and stick with it: link tags in the HTML head, an X-Robots-Tag style HTTP header for non-HTML files like PDFs, or xhtml:link entries in your XML sitemap. The sitemap route scales best for large sites, since a site with twenty languages would otherwise ship twenty-one link tags on every single page. Add x-default to name the version for unmatched languages, typically your global English page or a language selector. After deployment, verify in Google Search Console's international targeting reports and crawl a few pages to confirm every version returns the same complete tag cluster.

When to Use the Hreflang Generator

Use it whenever the same content exists in more than one language or is targeted at more than one country: launching translated versions of a site, splitting en-US and en-GB content with different spellings and currencies, or running country-specific stores on separate domains or subfolders. It is also the fix when Google shows the wrong language version in a country's search results, or when translated pages cannibalize each other's rankings. Generate the cluster once per page template, then reuse the structure across your site or sitemap generator.

Common Use Cases

  • Launching translated versions of a marketing site across European markets.
  • Separating US and UK English pages with different pricing and spelling.
  • Generating xhtml:link blocks for a programmatically built XML sitemap.
  • Pairing each language version with correctly localized titles and descriptions. Meta Tag Generator - SEO Tags in Seconds

Expert Tips

  • Always include the self-referencing tag; clusters without it are frequently discarded by search engines.
  • Use en-GB, not en-UK: hreflang regions follow ISO 3166-1, and invalid codes invalidate the whole entry.
  • Keep hreflang URLs identical to your canonical URLs; pointing hreflang at redirected or non-canonical addresses breaks the cluster.

Frequently Asked Questions

What does x-default do?
It names the page search engines should show when a searcher's language matches none of your declared versions. It typically points at your global or English page, or at a language selection page.
Should hreflang go in the HTML head or the XML sitemap?
Both work identically for search engines. The head is simpler for small sites; the sitemap variant keeps HTML lean and is easier to maintain programmatically once you have many languages, which is why the tool outputs both formats.
Why are my hreflang tags being ignored?
The most common causes are missing return links, since every listed URL must carry the identical tag set back, relative instead of absolute URLs, invalid codes like en-UK instead of en-GB, or pages that are blocked from crawling.

Related tools

12 suggested