Skip to content
100% local

Hreflang tag generator

Turn a list of language versions into a complete set of hreflang tags.

Input
Output

Hreflang tag generator

Hreflang tags tell search engines which URL to show for which language and region, so a French visitor lands on /fr/ instead of the English homepage. Writing them by hand does not scale past two or three versions: every page needs a link back to every other page, including itself, and one missed reciprocal link is enough for Google to ignore the whole set. Paste a list of language codes and URLs, one pair per line, and this tool builds the complete cross-linked set for you.

Enter each language version as a code and a URL, such as "en https://example.com/" or "pt-BR https://example.com/br/", on separate lines. The tool checks that each code has a plausible language(-region) shape and that each URL is absolute, skips anything that does not, and reports how many entries were skipped or repeated so a typo does not silently produce a broken set. Choose the output that fits where you are pasting it: HTML link tags for a page's head, HTTP Link headers for a server that cannot edit HTML (PDFs, images), or an XML fragment with xhtml:link alternates for each URL in your sitemap.

Add an x-default tag to cover visitors whose language does not match any listed version — search engines fall back to it, and browsers use it for a language-picker page. Pick which entered language it should point to, or type a line starting with "x-default" yourself to set the URL directly. A single language version has no page to link back to, so the tool treats hreflang as meaningful only once at least two are entered.

Everything runs locally in your browser. The URLs and language codes you enter for a hreflang set are often unpublished site structure, and none of it is uploaded anywhere — the tags are generated on your device and nowhere else.

FAQ

What format should I paste each language version in?
One language code and one absolute URL per entry, separated by a space, such as "en https://example.com/" or "de-CH https://example.com/ch/". Enter one pair on each line.
How does x-default work?
x-default is the fallback hreflang value search engines and browsers use when none of the other language tags match the visitor. Turn on "Add x-default" and pick which entered language it should point to, or add your own line starting with "x-default" to set the URL directly — an explicit x-default line always takes priority.
Why were some of my lines skipped?
A line is skipped when its language code does not look like a valid language or language-region tag, its URL is not an absolute http(s) address, or its language code repeats one already entered. The tally under the output shows how many were skipped or duplicated so you can go back and fix them.
Which output format should I use?
Use HTML tags for a page you can edit directly (paste them into <head>). Use HTTP headers when the page cannot carry HTML, such as a PDF or image. Use the XML sitemap fragment when you maintain hreflang through your sitemap instead of individual pages.
Is my URL list uploaded anywhere?
No. The tags are generated entirely in your browser and your language codes and URLs never leave your device.