Skip to content

Free Technical SEO tool

Hreflang Tag Generator

The Hreflang Tag Generator builds the <link rel="alternate" hreflang> tags that tell Google which language or regional version of a page to show each searcher. Add a row per version, pick its language and region, and copy a correctly formatted tag set ready for your <head>.

  • 100% free
  • No sign-up
  • Runs in your browser
Generated Head Tags

How it works

How to use the Hreflang Tag Generator

  1. Add each version

    Create one row for every language or regional variant of the page, including the page you are currently on.

  2. Set language and region

    Choose the language, then an optional region. The tool combines them into a valid code such as en-gb or fr-ca.

  3. Add an x-default

    Point x-default at your language selector or global version so unmatched visitors still land somewhere sensible.

  4. Paste into every page in the set

    Copy the block into the <head> of each version. Every page needs the identical full set.

What is hreflang?

Hreflang is an HTML attribute that tells search engines a page exists in more than one language or for more than one country, and which URL belongs to which audience. Without it, Google has to guess. It might show your US pricing page to someone in Manchester or your French content to a searcher in Quebec who would have preferred the Canadian version.

Each tag pairs a URL with a code made of an ISO 639-1 language and, optionally, an ISO 3166-1 region. en targets English speakers anywhere, en-gb targets English speakers in the UK, and x-default catches everyone else.

When you need hreflang

  • You publish the same content in different languages.
  • You have near-identical pages for different countries that share a language, such as UK, US and Australian English with different prices, spelling or delivery terms.
  • You run country subfolders (/uk/, /ie/), subdomains or separate ccTLDs.

If your site has a single language and a single market, you do not need hreflang at all.

Example hreflang set

A page available in UK English, US English and German, with a global fallback, would carry this block on all four URLs:

<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/pricing/">
<link rel="alternate" hreflang="en-us" href="https://example.com/us/pricing/">
<link rel="alternate" hreflang="de" href="https://example.com/de/preise/">
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing/">

Common hreflang mistakes

  • Missing return tags. Every page in the set must point back to every other page.
  • Invalid codes. en-uk, en-eu and region-only values are ignored.
  • Pointing at non-canonical URLs. Hreflang URLs should be the canonical, indexable, 200-status version of each page, never a redirect or a parameterised duplicate.
  • Conflicting canonicals. Canonicalising every language version to the English page tells Google the others are duplicates, which cancels out your hreflang.
  • Relative URLs. Always use absolute URLs, including the protocol.

On large sites, maintaining hreflang in page templates gets fragile. Hreflang can also be declared in your XML sitemap or, for PDFs and other non-HTML files, in HTTP headers. Pick one method and use it consistently.

Questions

Hreflang Tag Generator FAQs

Is the Hreflang Tag Generator free?

Yes. There is no account, no limit on the number of versions and no paid tier.

Do hreflang tags need to be reciprocal?

Yes. If page A references page B, page B must reference page A. Every page in a set should list every other version and itself. Missing return tags are the most common reason Google ignores hreflang.

Why is en-uk wrong?

Region codes follow ISO 3166-1, where the United Kingdom is GB, not UK. Use en-gb. Google ignores codes it does not recognise.

What does x-default do?

It names the fallback page for searchers whose language or location does not match any version you have tagged. A language picker or your international homepage is the usual choice.

Can I use a region code on its own?

No. A hreflang value must start with a language. en-gb is valid, gb on its own is not. A language without a region, such as de, is fine.

Is my data uploaded anywhere?

No. The tags are generated with JavaScript in your browser and nothing is sent to a server.

Work with The Search Foundry

Need the whole site checked properly?

Our technical SEO audits crawl every URL, prioritise fixes by revenue impact and come with a developer-ready action list.