Skip to content

Hreflang Tag Generator

Build the hreflang set for a page, with return links checked.

One per line as code | URL. Language is ISO 639-1, region is ISO 3166-1 Alpha 2 — so en-GB, never en-UK.

Where a visitor lands when none of the versions match their language.

Used to check the self-reference. Every version must list itself.

Hreflang tags

Your generated code appears here.

Quick Tool Overview

The Hreflang Tag Generator builds the full set of language and region tags for a page, including the self-reference every version needs and the x-default that catches everyone else. It validates the codes against ISO 639-1 and ISO 3166-1 — catching en-UK, the single most common hreflang error — and outputs both the HTML and XML sitemap forms.

What it does
Generates a complete, reciprocal hreflang set for a page
You give it
One "language-REGION | URL" per line for every version
You get back
Link tags for the head and xhtml:link entries for a sitemap
Best for
Multilingual and multi-region sites of any size
SEO Tools Free, unlimited use No sign-up Runs in your browser

About the Hreflang Tag Generator

List each language version of a page with its URL and the generator writes the full hreflang set — including the self-reference every page in the group needs, and the x-default entry that catches everyone the group does not cover. The XML sitemap form is produced alongside the HTML one.

Hreflang is unusually unforgiving, and almost all of the failures are one of four things. The codes must be ISO 639-1 for language and ISO 3166-1 Alpha 2 for region, written as en-GB — not en-UK, which is not a country code, and not en_GB with an underscore. Every page in the group must list every other page including itself, so a set of five languages means five tags on each of five pages. The URLs must be absolute. And the return links must be reciprocal: if A points at B but B does not point back at A, Google discards the pair. All four are checked here.

Key features of the Hreflang Tag Generator

Code validation

en-UK, en_GB and invented regions are caught before they reach a live page, where they simply fail silently.

Self-references included

Every page must list itself. The generator adds that automatically rather than leaving it to memory.

x-default handled

The fallback entry is generated properly, pointing wherever unmatched visitors should land.

Both output formats

HTML link tags for the head, or the xhtml:link form for an XML sitemap, from the same list.

Reciprocity explained

The panel shows exactly which tags need to appear on which page, which is the part that gets skipped.

How to use the Hreflang Tag Generator

  1. 1

    List your versions

    One per line as "en-GB | https://example.com/page", covering every language version of this page.

  2. 2

    Add x-default

    Point it at the version people land on when none of the others match — usually a selector or the English page.

  3. 3

    Check the codes

    Invalid combinations like en-UK are flagged, along with duplicates and missing self-references.

  4. 4

    Copy for HTML or sitemap

    Take the link tags for the head, or the xhtml:link form for an XML sitemap.

Frequently asked questions

Because UK is not the ISO 3166-1 country code for the United Kingdom — GB is. hreflang takes ISO 639-1 for language and ISO 3166-1 Alpha 2 for region, so it is en-GB. en-UK is the single most common hreflang error and it invalidates the tag entirely.

Reviews of the Hreflang Tag Generator

What people who use the Hreflang Tag Generator think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the Hreflang Tag Generator. It takes half a minute and no account.

Write the first review

More SEO tools