Hreflang tag generator

Plug in every language and regional version of a page. You get the complete, matching set of hreflang tags, checked against Google's rules as you type.

One row per language or regional version of this page. The same set goes on every version, including a row for the page itself.

  1. English

  2. English in United Kingdom

  3. German

  4. Fallback for unmatched languages

4 versions

Paste into the <head> of every URL listed.

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

Checks

Set is valid against Google’s rules.

Describe your site, get a starting set

Explain your language and country setup in plain words. The AI planner drafts the cluster for one page; every row is then checked by the same validator before you load it into the generator.

How to use the generated tags

  1. List every version, including this one. A German page that links to English and French but not to itself breaks the set. Google's rule is that each version lists itself and all the others.
  2. Use absolute URLs. https://example.com/de/, never /de/ or //example.com/de/.
  3. Paste the same block on every version. If page X links to page Y, page Y must link back to X. Identical blocks give you those return links automatically.
  4. Pick one method. HTML tags, HTTP headers and sitemaps are equivalent to Google. Using several at once adds maintenance without any benefit in Search.
  5. Check the live pages. Once deployed, run the URL through the hreflang checker. It fetches each alternate and confirms that every return link exists.

Need a sitemap for hundreds of pages? Switch to Many pages (pattern) above, or go straight to the hreflang sitemap generator. Already have tags and want a second opinion? Paste them into the validator.

What a correct set looks like

A pricing page with a US-English default, a British version, a German version and a fallback for everyone else:

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

Here en is the catch-all for English speakers outside the UK, which Google recommends whenever you split a language by region. The x-default points to the same URL as en, which is fine: one URL can carry several codes. For the reasoning behind each line, read what hreflang is and how Google uses it.

Hreflang generator questions

What does this hreflang generator produce?

A complete, symmetrical hreflang set in the three formats Google accepts: <link rel="alternate" hreflang> elements for the HTML head, an HTTP Link header, or an XML sitemap with xhtml:link entries. Google treats all three as equivalent, so pick the one that fits your stack.

Do I put the same tags on every language version?

Yes. Each version must list itself and every other version. The generated block is identical on all pages in the set, which is what creates the return links Google looks for.

Should I include x-default?

It is optional. Add it when you have a page for visitors whose language you do not serve, such as a country selector or your global English page. Google uses it when no other code matches the searcher.

Can I write en-UK or en-EU?

No. UK and EU are reserved codes, not assigned ISO 3166-1 alpha-2 country codes, and Google says they have no effect. Use en-GB for the United Kingdom and target EU countries individually.

Is hreflang case-sensitive?

No. Google accepts en-gb and en-GB alike. The generator writes regions in upper case because that follows the ISO 3166-1 convention and is easier to scan.

Does the tool store my URLs?

Your rows are saved only in your own browser (localStorage) so they are still there next visit. Nothing is sent to a server unless you use the AI planner. You can clear it on the privacy page.