xhtml:link · alternatefree · no sign-up

Hreflang sitemap generator

One column per language, one row per page. Out comes a sitemap where every language version lists every other — the part people get wrong by hand.

1

Language versions

Header row of hreflang codes (en, en-GB, de, x-default…), then one row per page with the URL of each language version. Every URL gets the complete set of alternates — itself included — so return links are always correct. Leave a cell empty when a page has no version in that language.

Or upload a CSV
2

Your sitemap

12 URLs
  • 12entries
  • 1file
  • 6.2 KBuncompressed
  • Validprotocol check
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://www.example.com/en/</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/"/>
  </url>
  <url>
    <loc>https://www.example.com/en-gb/</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/"/>
  </url>
  <url>
    <loc>https://www.example.com/de/</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/"/>
  </url>
  <url>
    <loc>https://www.example.com/hi/</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/"/>
  </url>
  <url>
    <loc>https://www.example.com/en/pricing</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/pricing"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/pricing"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/pricing"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/preise"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/pricing"/>
  </url>
  <url>
    <loc>https://www.example.com/en-gb/pricing</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/pricing"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/pricing"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/pricing"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/preise"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/pricing"/>
  </url>
  <url>
    <loc>https://www.example.com/de/preise</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/pricing"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/pricing"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/pricing"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/preise"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/pricing"/>
  </url>
  <url>
    <loc>https://www.example.com/hi/pricing</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/pricing"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/pricing"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/pricing"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/preise"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/pricing"/>
  </url>
  <url>
    <loc>https://www.example.com/en/contact</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/contact"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/contact"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/contact"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/kontakt"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/contact"/>
  </url>
  <url>
    <loc>https://www.example.com/en-gb/contact</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/contact"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/contact"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/contact"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/kontakt"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/contact"/>
  </url>
  <url>
    <loc>https://www.example.com/de/kontakt</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/contact"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/contact"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/contact"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/kontakt"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/contact"/>
  </url>
  <url>
    <loc>https://www.example.com/hi/contact</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/contact"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/contact"/>
    <xhtml:link rel="alternate" hreflang="en-GB" href="https://www.example.com/en-gb/contact"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/kontakt"/>
    <xhtml:link rel="alternate" hreflang="hi" href="https://www.example.com/hi/contact"/>
  </url>
</urlset>

Next: upload sitemap.xml to your site root so it is reachable at https://www.example.com/sitemap.xml, add this line to robots.txt, then submit sitemap.xml in Google Search Console (Indexing → Sitemaps) and Bing Webmaster Tools.

Sitemap: https://www.example.com/sitemap.xml

Why put hreflang in the sitemap

Hreflang tells Google which URL to show to which language or region. You can declare it in HTML <link> tags, HTTP headers or the sitemap. The sitemap is easiest to maintain at scale: no template changes, and one file to review.

The rules that break most implementations: each URL must list itself, every alternate must link back (return links), codes must be valid (en-GB, not en-UK or en_GB), and x-default marks the fallback for everyone else. Building from a grid makes all of that automatic.

Questions

What does x-default do?

It names the page for users whose language or region matches none of your versions — often a language picker or the international English page.

Should I use region codes?

Only when content differs by region (prices, spelling, shipping). en alone targets all English speakers; en-GB and en-US target specific regions.

Does hreflang need to be in both HTML and the sitemap?

No — one method is enough. Mixing methods is allowed but they must agree.

Can I check an existing hreflang sitemap?

Yes. The validator checks codes, self-references and missing return links between URLs in the same file.