UTILS.
Private by default
hl

Hreflang Tag Generator

Generate hreflang alternate link tags from a list of language and URL pairs.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →
— output appears here —

About this tool

Turn a list of language codes and URLs, one pair per line, into <link rel="alternate" hreflang> tags, optionally adding an x-default; everything runs in your browser.

Each line is split on whitespace into a code and a URL, so use a space, not an equals sign; lines with one part are ignored silently. Accepted codes are a 2-3 letter language with optional 4-letter script and 2-letter or 3-digit region (en, en-GB, zh-Hant, es-419), or x-default. Codes ending in -uk, and repeats in any letter case, are skipped and listed above the output. The x-default tag reuses the first URL unless you typed one. URLs are not validated.

Frequently asked questions

What is x-default for?
The x-default hreflang value points search engines to the page to show when no other language matches the visitor's settings, such as a language selector.
What format should each line use?
Each line is a language or region code followed by its URL, for example 'en-us https://example.com/' separated by a space.
Why was a line skipped?
It had only one part, its code did not match the accepted pattern, or the code had already appeared.
Does it check my URLs?
No. They are copied as typed, with double quotes escaped.

More tools