Hreflang Tag Generator

Generate correct hreflang HTML link tags and sitemap XML entries for international SEO. Add your localized URLs, select languages and regions, and copy the output.

URL & Language Mapping

Generated Output

HTML <link> Tags
Sitemap XML
Place these inside the <head> of every localized page. Each alternate page should reference all others.

How it works

Hreflang tags tell search engines which language and region a page targets. For each localized URL, the tool builds a full set of <link rel="alternate" hreflang="…" href="…"> tags — one per variant, plus an optional self-referencing tag and an x-default fallback. The formula is simple: every page in a language group must reference every other page in that group (bidirectional, symmetric). The sitemap output emits the same mapping as <xhtml:link> elements inside each <url> entry. The generator validates URLs, formats codes as lang or lang-COUNTRY, and escapes XML entities automatically.

Frequently Asked Questions

What is an hreflang tag and why is it important?
An hreflang tag is an HTML attribute (or sitemap entry) that tells search engines the language and geographical target of a page. It prevents duplicate-content issues across localized versions and helps Google serve the right page to the right user in international search results.
Do hreflang tags need to be reciprocal?
Yes. Google requires hreflang annotations to be bidirectional — if page A points to page B with hreflang, page B must also point back to page A. Missing reciprocal tags cause Google to ignore the entire set. This generator automatically produces complete reciprocal sets for you.
Should I use HTML tags or a sitemap for hreflang?
Both are valid and equivalent for SEO. Use HTML <link rel="alternate"> tags in the page <head> for small sites. Use a sitemap when you have many pages, non-HTML documents like PDFs, or want to keep markup clean. Never mix formats for the same set of pages.

Related Tools

Copied to clipboard