← Toolz / SEO & Web / Hreflang Tag Generator

Hreflang Tag Generator

SEO·16

Add one row per language or regional version of your page. The HTML link tags and a complete, self-referencing XML sitemap block update as you type — nothing is uploaded, everything happens in your browser.

Language versions

Return tags are not optional. Hreflang only works as a complete set: every page in the set must link back to all the others, including itself. If page A lists the English, German and French versions, then the German and French pages must each carry the same full set of tags pointing back. If one page in the set is missing its return tags, Google can ignore the annotations for the whole set — a one-way hreflang is treated as no hreflang. The sitemap output below follows the same rule: every URL entry contains the full set of alternates, including a link to itself.

Your hreflang output

Build valid hreflang link tags and a self-referencing XML sitemap block for multilingual pages — with live validation.

100% free · No sign-up · No daily limits · No watermarks · Processed in your browser — files never leave your device

UNDERSTAND YOUR RESULTS

Hreflang Tag Generator — Correct Language Tags for Every Page Version guide

Build the complete hreflang set for a multilingual page: HTML link tags for the head and a self-referencing XML sitemap block, with live checks for invalid codes, duplicates and non-https URLs.

How to use this tool

  1. Add one row per language or regional version of the page — pick a code from the suggestions (en, en-US, es-MX, zh-Hans…) or type any other valid code, then paste the full URL of that version.
  2. Fix anything the live validation flags: an invalid code shape, a code used twice, an empty URL, or a URL that is not fully qualified https. Codes are normalised for you — en-us becomes en-US.
  3. Tick the x-default field and add its URL if you have a fallback page for visitors whose language or region matches none of the set.
  4. Copy the HTML tags into the <head> of EVERY page in the set — each page must carry the full set, pointing at all the others and at itself — or copy the sitemap block into your XML sitemap instead. Never mix a partial set.
  5. Download the .txt or .xml file if you are handing the tags to a developer or a CMS template rather than pasting them yourself.

A worked example

A shop sells in three markets from one product page: the US version at https://example.com/en-us/shoes, the UK version at https://example.com/en-gb/shoes and a global fallback at https://example.com/shoes. Three rows (en-us, en-gb, plus the x-default field) produce three link tags and a sitemap where each URL entry lists all three alternates — so Google sends US searchers to the dollar-priced page and UK searchers to the pound-priced one instead of whichever it happened to crawl first.

What you can do with this tool

How it works

The generator normalises every code the way Google expects it — language subtag lower-case, script title-case, region upper-case — and validates the shape (two or three letters, optional four-letter script, optional two-letter or three-digit region, or the special x-default). The sitemap output follows Google’s own pattern: one <url> entry per page whose <loc> is that page, containing the FULL set of <xhtml:link> alternates including a self-reference, under a <urlset> that declares the xmlns:xhtml namespace.

Frequently asked questions

What is hreflang, in plain words?

Hreflang tells search engines which language and region each version of a page is for, and which pages are versions of each other. Without it, Google guesses — and often shows the wrong-language or wrong-currency page to a searcher. With it, each searcher is offered the version written for them.

What is x-default and do I need it?

x-default names the fallback page shown when a visitor’s language and region match nothing in the set — often a language-selector page or your main-market version. It is optional, but recommended whenever you have a sensible fallback; it is a value in the set, not a page language.

Should I use the HTML tags or the sitemap?

Either — Google reads both. HTML tags suit small sets and hand-built pages, and must be added to every page in the set. The sitemap suits large or CMS-driven sites because the whole set lives in one file and pages do not each need editing — but the sitemap must then list every URL with the full alternate set, exactly as this tool generates it.

Why did Google ignore my hreflang tags?

The usual causes: one page in the set missing its return tags, a tag pointing at a redirected, blocked or non-200 URL, conflicting signals (a canonical pointing at a different language version), or codes in the wrong shape. Paste your set back into this tool to check the codes, then verify every page in the set carries the identical full set.

Can I target a language without a region, like plain es?

Yes — a language-only code such as es or fr targets every speaker of that language worldwide. Add regional versions (es-ES, es-MX) only when the pages genuinely differ by market; splitting a set you cannot maintain produces thin duplicates instead of coverage.

Do hreflang tags help rankings?

They do not boost a page directly. What they fix is matching: the right version gets shown to the right searcher, which reduces wrong-language landings and the duplicate-content confusion that comes from near-identical regional pages competing with each other.