Build line

Hreflang sitemap generator

Header row: your language codes. Every row after that is one page in all its languages. You get a multilingual sitemap where every version lists every alternate, itself included.

Comma, tab or semicolon separated. Quote cells that contain commas. Everything is built in your browser.

0<url> entries
0page groups
1errors
110 Bsize
  • error The first row must list language codes, e.g. en,de,fr-CA,x-default.

Paste rows or load the example to see the XML build live.

The three hreflang mistakes this avoids

Missing return links

Google ignores an hreflang pair unless both pages confirm it. Generating from one table row means every page in a group lists exactly the same set.

Forgetting the self-reference

Each URL's alternates must include the URL itself. Hand-written files often skip it.

Invented codes

en-UK, jp and en-EU aren't valid. Codes are an ISO 639-1 language (ja), optionally followed by an ISO 3166-1 region (en-GB). The header row is checked as you type.

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

Questions people ask

Why put hreflang in the sitemap instead of the HTML?
All three methods (HTML <link> tags, HTTP headers and sitemaps) are equivalent for Google. Sitemaps keep the markup out of your templates and are easiest to generate from a translation table, especially with many languages.
Does every URL need to list itself?
Yes. Each language version must list every alternate including itself, and the links must be reciprocal: if the German page points to the French one, the French page must point back. This generator writes the full set for every URL, so reciprocity is automatic.
What is x-default?
The fallback for visitors whose language you don’t target, often a language picker or your international home page. It appears as an alternate on every entry but does not get its own <url> unless it is also a language version.
en-UK or en-GB?
en-GB. Region codes are ISO 3166-1 alpha-2, and the United Kingdom’s code is GB. The generator warns about en-UK.
Hreflang made my sitemap huge. Is that a problem?
Every URL carries every alternate, so a 20-language site multiplies file size fast. You may hit the 50 MB limit well before 50,000 URLs; the splitter explains the maths.