Free Hreflang Tag Generator & Checker

Free hreflang generator: create alternate link tags, XML sitemap xhtml:link entries or HTTP headers with x-default, and validate existing hreflang code.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideHow to Implement Hreflang Tags Correctly on a Multilingual Site →

About the Hreflang Tag Generator tool

If your site has versions for different languages or countries, hreflang annotations tell search engines which URL to show each audience, so a searcher in France sees your French page and one in the UK sees prices in pounds. The rules are strict: codes must be ISO 639-1 languages with optional ISO 3166-1 regions, every page in the set must list all the others and itself, and URLs must be absolute. A single typo such as en-UK instead of en-GB silently breaks the annotation.

This hreflang generator builds the full set from a list of language versions. Enter a code and URL for each version, add x-default for the fallback page, and choose the output: HTML link tags for the head of every page, an XML sitemap with xhtml:link alternates for every URL, or an HTTP Link header for PDFs and other non-HTML files.

Validation runs on the generated set and on code you paste into the “Validate existing code” tab, which reads link tags, sitemap entries and Link headers. It catches underscores instead of hyphens, invalid language codes, region-only values, wrong country codes such as UK, unsupported numeric regions like 419, duplicate codes, relative URLs and a missing x-default. Everything runs locally.

How to use Hreflang Tag Generator

  1. On the “Generate” tab enter one hreflang code and URL per row under “Language versions”.
  2. Add an x-default row for the page shown to everyone else, using “Add language” for more rows.
  3. Choose “HTML tags”, “XML sitemap” or “HTTP header” and copy or download the output.
  4. Fix anything flagged in “Checks”, then add the same block to every page in the set.
  5. To audit live code, open “Validate existing code” and paste the tags, sitemap entries or header.

Features

Three output formats

Head link tags, sitemap xhtml:link entries for every URL, or an HTTP Link header.

Code validation

Checks every value against ISO 639-1 languages and two-letter region codes.

Common mistake detection

Flags en_GB, en-UK, region-only codes, numeric regions and duplicates with the fix.

Validate existing code

Paste link tags, sitemap snippets or Link headers to audit a live implementation.

x-default guidance

Warns when the fallback is missing and when a language has no generic version.

When to use it

  • Set up hreflang for a shop with UK, US and Irish English versions plus French and German.
  • Add alternates to an XML sitemap when editing hundreds of page heads is impractical.
  • Audit a site where Google shows the US page to UK searchers.
  • Add hreflang headers to translated PDF brochures.

Frequently asked questions

What format should hreflang codes use?

An ISO 639-1 language code, optionally followed by a hyphen and an ISO 3166-1 alpha-2 region, such as fr, en-GB or es-MX. A region cannot be used on its own.

Is en-UK a valid hreflang code?

No. The ISO country code for the United Kingdom is GB, so use en-GB. en-UK is ignored by search engines.

What is x-default?

x-default marks the page to show users whose language or region does not match any of your listed versions, often a language selector or your main international page.

Does every page need to link to the others?

Yes. Hreflang must be reciprocal: each page in the set lists all versions, including itself. If page A points to B but B does not point back, the annotation may be ignored.

Should I use HTML tags or the sitemap?

Both work equally well for Google. Use one method consistently. Sitemaps are easier for large sites; HTTP headers are for non-HTML files such as PDFs.

Does Bing support hreflang?

Bing mainly uses the content-language meta tag or HTTP header and treats hreflang as a weaker signal. Using both does no harm.

Related tools