Free tools / hreflang-generator
FREE TOOL · GENERAL SEO, NOT AI VISIBILITY · NOTHING LEAVES THIS TAB
hreflang Tag Generator
This is a classic technical-SEO fix, not a measurement of AI visibility — hreflang tells Google and Bing which language or region version of a page to show; it has nothing to do with whether an AI assistant cites you. List your page’s versions on the left; the tags, the HTTP header and the sitemap entries appear on the right.
Language and region versions
0 usable
Output
ok ✓Paste the <link> tags inside <head> — on every one of the pages listed, not only one of them.
What this actually checks
Runs entirely in your browser. Nothing you type here is sent anywhere. (checkable — open your network tab and type: nothing fires. Copy and download are counted; the text is not.)
THE MISTAKE THIS TOOL EXISTS TO CATCH
A country is not a language, and hreflang cannot guess which one you meant
The two-letter code that shows up most in a broken hreflang tag is a country code sitting where a language code belongs. uk looks right for “the UK version” — it is not a language, and hreflang has no way to read it as one:
hreflang targets a language first, and a region only on top of one. A region by itself is not a valid value.
Here is the same intent written both ways — on the left the tag people actually write, on the right what this generator produces:
<link rel="alternate" hreflang="uk" href="https://example.com/uk/" />
Not a language. uk is the ISO 3166-1 region for the United Kingdom — it has never been a language code, so a crawler that validates the value discards the whole tag.
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/" />
Language, then region. en is the ISO 639-1 language; GB is the ISO 3166-1 region riding on top of it. This tool flags the language field the moment it holds a country code instead.
The reverse mistake is just as common: a region typed with no language at all. hreflang has no slot for “just the United Kingdom” — every value needs a language, and a region is only ever an addition to one. This tool will not let a row through with a region and no language.
GOOGLE’S DOCUMENTED RULES
The rules this tool checks against
Set out at developers.google.com/search/docs/specialty/international/localized-versions:
01
Language first, region optional
A value is an ISO 639-1 language code, on its own or with an ISO 3166-1 region after a hyphen — fr or fr-CA. A region with no language, like CA alone, is never valid.
02
Every address is absolute
href="/en/" is silently ignored. Google’s own guidance is explicit that a relative path does not work here — every address needs its scheme and its domain.
03
Each page lists itself
A page’s own address belongs in its own set of tags, alongside every other version. Leave a page out of its own list and Google may not treat the set as valid at all.
04
The links point back
If page A lists page B, page B must list page A — with the identical set of tags on both. One-directional hreflang is documented to be ignored.
05
One x-default, at most
hreflang="x-default" names the page to show a visitor whose language matches nothing else in the set — a splash page or a language chooser, most often. It is optional, and there is only ever one.
06
It is a hint, not a ranking factor
Google has stated plainly that hreflang affects which version is shown, never whether or how highly any version ranks. Nothing about it makes a page more visible — only more correctly matched.
THREE OUTPUTS, THREE DIFFERENT JOBS
Which one you need depends on what kind of page this is
The same set of language versions, written three ways — because hreflang can be declared in three different places, and most sites only ever need one of them.
<link> tags
For an ordinary HTML page
Paste these inside <head>. This is the form almost every site uses, and the only one that needs no server configuration at all.
HTTP header
For a page that is not HTML
A PDF or any other non-HTML file has no <head> to put a tag in. The same information goes on the HTTP Link response header instead — set server-side, which this tool cannot do for you.
XML sitemap
For a large site
An xhtml:link entry inside your sitemap declares every language version for every URL in one file, without touching a single page’s markup — the usual choice once a site has more pages than anyone wants to hand-edit.
Use one, not two. Declaring hreflang two different ways for the same page is a documented source of conflicting signals — pick the form that fits how the page is served and stop there.
WHAT THIS TOOL CANNOT DO
We’d rather tell you the limit
than sell you the tags.
It cannot see your other pages
The reciprocal-linking rule is the one this tool is least able to help with: it never fetches any of the URLs you type in, so it cannot confirm that /fr/ actually carries a tag pointing back at /en/. That check needs each live page read, which is a job for a crawler, not a generator running in one tab.
It also cannot place the file. The tags, the header line and the sitemap entries are text — getting them into your <head>, your server config or your live sitemap is still a step you take afterward.
Limitations, stated plainly
Validation here is against known code lists — ISO 639-1 languages and ISO 3166-1 regions — not a live registry lookup, so a code retired or added after this page was built would not be caught either way. It checks shape, never content: nothing here confirms the pages you listed are actually translations of each other, or that they exist.
And hreflang is a hint Google says it usually follows, not a guarantee. A page can carry perfect tags and still be shown to the wrong visitor on an off day — the documented behaviour is “signals,” not “determines.”
FAQ
Fair questions.
We use our own tool on this page.
Does this improve my AI visibility?
No, and this page is not built to claim otherwise. hreflang is a signal for Google and Bing about which language version of a page to serve — it is classic technical SEO, unrelated to whether an AI assistant names or cites you. If that is what you are working on, the rest of this site’s free tools are built for it; this one is not.
Do I need a region code?
Only if you have more than one version of the same language. fr alone covers every French-speaking visitor; add fr-CA only once you also have a page written specifically for Canada, so the two can be told apart.
Which output do I actually need?
The <link> tags, almost always — that is the form for an ordinary HTML page. Reach for the HTTP header only for a non-HTML file such as a PDF, and the sitemap form only once hand-editing every page’s <head> stops being realistic.
Will this raise my ranking?
No. Google has stated that hreflang affects which version of a page is shown to whom, not whether any version ranks higher. Getting it right can stop the wrong-language version outranking the right one in a given country — that is a correction, not a boost.
Is anything I type here uploaded?
No. This tool builds the tags, the header line and the sitemap entries from your rows inside your own browser tab. Not one character you type is sent to us, nothing is fetched from the addresses you enter, and nothing you type is stored — open your browser’s network panel and type, and no request fires at all. What does leave the page is the fact that you pressed copy or download: one line to our own counter and to Google Analytics naming the button and the page, never its contents, set out in full on our privacy page.
TAGS IN A FILE ARE NOT TAGS A CRAWLER SEES
If a script writes your <head>,
check what actually ships in it.
A tag that only appears after your page’s JavaScript runs is invisible to anything that does not run it. See exactly what a non-rendering crawler receives — status, title, headings and the raw HTML — before you decide these tags are really there.