Code · Made a little simpler

Hreflang Tag Generator

Generate an HTML hreflang set or an XML sitemap for equivalent language versions. Check locale codes, conflicting URLs and the optional x-default destination before copying or downloading.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Enter one language and page URL per line, separated by ->. Use x-default for an optional fallback.

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

Hreflang Tag Generator: how to use it

  1. Enter one language code and canonical page URL per line separated by ->. Add x-default when you have a fallback destination.
  2. Generate hreflang and resolve any line-specific findings. Choose HTML head tags or an XML sitemap for the selected origin.
  3. Copy or download the output. For HTML, install the same set on each listed page and check the published pages for self-references and return links.

Limits and notes

Up to 32 mapping lines. Full HTTP(S) URLs must serialize to fewer than 2,048 characters and omit fragments and credentials. Supports known two-letter languages with optional script and two-letter region codes, and x-default. Exports a sitemap for each distinct origin and limits generated alternate markup to 2 MB. Only the supplied mappings are checked. No URLs are fetched.

How your privacy works →

Hreflang Tag Generator: common questions

Do I need different HTML tags for each page?

Put the same HTML set in the head of every listed page. Each set includes the page’s own link and all other alternate pages.

Can related pages use different domains?

Yes. HTML tags retain the full URL of every alternate. The XML view groups `<loc>` entries by origin while retaining all alternate links in each entry.

Is x-default required?

It is optional. Add it if you have a page or selector for visitors whose language or region has no matching version.

Tool guides