Hreflang Tag Generator
Runs in your browser — your data is never uploaded.
Turn a list of language and URL pairs into hreflang tags, either as link elements for your <head> or as the XML form that goes in a sitemap. Region subtags are checked against the mistakes that actually happen — en-UK instead of en-GB, a language code where a country belongs — and x-default is added for everyone your set does not cover. The output spells out the reciprocity rule, which is what quietly defeats most hreflang setups.
0 characters · runs entirely in your browser
How to use Hreflang Generator
- 1
Add one line per version: the language tag, a space, then the absolute URL.
- 2
Choose HTML link tags or the sitemap XML form.
- 3
Click “Generate”. Every page in the set must carry the same block, including a link to itself.
Share
Embed this tool on your site
Paste this where you want the tool to appear. It runs entirely in your visitor's browser — no uploads, no account, no tracking.
Please keep the attribution line — it's what keeps these tools free.
Need a different size, a dark theme, or a different tool? Build an embed lets you preview it first.
Frequently asked questions
Why is my hreflang being ignored?+
Almost always because it is not reciprocal. If /en/ points at /fr/ but /fr/ does not point back at /en/, the whole relationship is discarded — silently, with no error and nothing in a report. The set must also be self-referential: each page lists itself along with the others.
HTML tags or the sitemap version?+
They are equivalent, so pick on maintenance cost. HTML tags mean every page carries a link for every language — with 5 locales and 1,000 pages that is 25,000 tags to keep in sync. The sitemap form puts the whole matrix in one file you can regenerate, which is why large multilingual sites use it.
Is en-UK valid?+
No. The region subtag is ISO 3166-1 alpha-2, where the United Kingdom is GB. en-UK is a tag with an unknown region and is ignored. The same trap catches EU, which is not a country code at all — there is no way to target the EU as a block.
What is x-default for?+
The page to show anyone whose language and region your set does not match. Usually an international landing page or your primary-language version. It is optional, but without it a visitor outside your listed locales is matched by whatever Google considers closest.
Does hreflang stop duplicate content problems?+
Not really. It tells Google which version to show which user; it does not merge signals or stop two near-identical language versions competing. Two English pages differing only in currency still need a canonical decision on top of hreflang.