Free tools that run in your browser. Use any tool without an account.

Favourites Cart
Sign in
Join free

Hreflang Tag Generator

  • Free
  • Runs in your browser
  • No account needed

An hreflang tag generator creates HTML, XML sitemap, or HTTP header references between localized pages. FreeToolr checks codes and common input issues, such as en-UK, relative URLs, repeated codes, and a missing optional x-default.

Hreflang tags
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="ar-AE" href="https://example.com/ae/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Checks
- Tip: you have ar-AE but no plain "ar"; a plain language version catches the same language in other countries.
Runs in your browser. Your files and values are not sent to us. Report a problem
Advertisement

About the Hreflang Tag Generator

FreeToolr's Hreflang Tag Generator creates references between language and regional versions of the same page. It suits website owners, developers, technical SEO teams, and agencies managing pages for markets such as the UK, Nigeria, the Gulf, or Europe. Enter one language code and full URL per line, then choose HTML, XML sitemap, or HTTP header output. You can add an optional x-default URL. The tool runs in your browser, so nothing is uploaded. Results update as you type, with no calculate button. Checks cover ISO 639-1 language codes, ISO 3166-1 regions, relative URLs, repeated codes, and a missing x-default. You can copy the result or share a link that reopens with your numbers. Its three output formats make it useful beyond head tags, while its warnings catch common input mistakes before implementation.

How to use it

  1. 1Enter one language version per line using the format code URL, such as en-GB https://example.com/uk/page/.
  2. 2Add an x-default URL if you use a fallback page.
  3. 3Choose HTML link tags, XML sitemap entries, or an HTTP Link header.
  4. 4Review the Hreflang tags and Checks results as they update instantly.
  5. 5Copy the output or share a link that reopens with your numbers.
Advertisement

Worked example

Input language versions: en-GB https://example.com/uk/product/ and fr-FR https://example.com/fr/produit/. Input x-default URL: https://example.com/choose-country/. For HTML output, the exact result is: <link rel="alternate" hreflang="en-GB" href="https://example.com/uk/product/" /> <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/produit/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/choose-country/" />

How it works

Writes one alternate link per language version: <link rel="alternate" hreflang="code" href="URL" />, sitemap xhtml:link entries, or an HTTP Link headerChecks each code against ISO 639-1 languages and ISO 3166-1 regions (en-UK is wrong; the UK is GB), flags relative URLs, repeated codes and a missing x-defaultEvery page in the group must list all versions, including itself, and the links must point both ways

Source: Google Search Central: Localized versions of your pageISO 639 language codesISO 3166 country codes. Last checked 11 November 2026.

What it is good for

  • Create HTML, XML sitemap, or HTTP header output.
  • Catch invalid codes, relative URLs, and repeated codes while typing.
  • Keep the full version set ready for each localized page.
  • The tool checks your inputs but does not fetch pages or confirm live reciprocal links.
  • It does not check status codes, canonicals, noindex directives, or redirects.
Advertisement

Questions people ask

What is an hreflang tag?

An hreflang tag identifies a language or regional version of a page. Search engines can use this information when selecting a suitable URL for users.

Is en-UK a valid hreflang code?

No. Use en-GB because GB is the ISO 3166-1 region code for the United Kingdom. Put the language first, followed by the optional region.

Do hreflang URLs need to be absolute?

Yes. Use the complete URL, including https://. Relative paths such as /uk/page/ can cause implementation problems.

Does every page need to list itself?

Yes. Each page in the group should list every version, including its own URL. The same complete set should appear on every version.

Do hreflang links need to point both ways?

Yes. If one page references another, the other page should reference it back. This creates the reciprocal relationship search engines expect.

Is x-default required?

No. x-default is optional. It can point to a language selector or another fallback page for visitors who do not match a listed language or region.

Where can I use hreflang output?

You can add HTML link tags inside the page head, xhtml:link entries in an XML sitemap, or an HTTP Link header for PDFs and other files. Choose the format that fits your site.

Help keep every tool free

FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.

Advertisement
Advertisement