Free tools / hreflang-generator

FREE TOOL · GENERAL SEO, NOT AI VISIBILITY · NOTHING LEAVES THIS TAB

hreflang Generator

A free hreflang tag generator: list each language or region version of a page and get the <link> tags, the HTTP header and the XML sitemap entries, with every code checked. 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.

running now general SEO, not AI visibility no card

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.)

    WHAT HREFLANG IS, AND HOW TO ADD IT

    How to add hreflang tags, in four steps

    An hreflang tag is a line that tells Google and Bing “this page also exists in these other languages, at these addresses”, so a searcher in Mexico gets your Spanish page and a searcher in Germany gets your German one. It changes which version is shown, not how high any version ranks.

    01

    List every version of the page

    One row per language or language-and-region version, each with its full address — including the page you are on. Add an x-default only if you have a fallback page, such as a language chooser.

    02

    Generate one format

    <link> tags for ordinary pages, the HTTP header for PDFs and other non-HTML files, the XML sitemap when there are too many pages to edit by hand. Pick one; declaring the same set two ways invites conflicts.

    03

    Put the same set on every version

    The identical block goes on every page in the set, not just the original. If the French page lists the English one, the English page must list the French one back, or Google can ignore both.

    Step 4: check what actually shipped. Open each page’s source (View Source, not the browser inspector) and confirm the tags are in the <head> the server sends. Tags written by JavaScript only exist after the page runs; Google’s URL Inspection tool in Search Console shows the HTML Google rendered, and our Render Check shows whether a page arrives with its content before any script runs.

    THE MISTAKE THIS TOOL EXISTS TO CATCH

    A country is not a language, and hreflang cannot guess which one you meant

    The most common broken hreflang value is a country code written where a language code belongs, or the wrong code for the country. en-UK looks right for “the UK version” — but the ISO 3166-1 code for the United Kingdom is GB, and UK is only a reserved code, not an assigned region:

    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:

    <head>EXAMPLE DATA · INVALID
    <link rel="alternate" hreflang="en-UK" href="https://example.com/uk/" />

    Not a region. UK is a reserved code in ISO 3166-1, not an assigned one — the United Kingdom’s is GB, and Google ignores UK. This tool rejects UK in the region field.

    <head>EXAMPLE DATA · WHAT THIS TOOL WRITES
    <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 also flags the language field when it holds a country code that is not a language, such as gb, jp or cz.

    Two country codes are worse, because they are real languages and pass every check: uk is Ukrainian and se is Northern Sami. hreflang="uk" on your British page tells Google it is for Ukrainian speakers; hreflang="se" on your Swedish page (Swedish is sv) says Northern Sami. This tool accepts both, because both are valid — so read the language column back before you copy.

    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.

    HREFLANG COUNTRY AND LANGUAGE CODES

    The codes people get wrong, and the ones they meant

    Language is ISO 639-1, lowercase by convention; region is ISO 3166-1 alpha-2, uppercase by convention. The tool checks every code against those two lists.

    Example values · what is written vs what was meant
    WrittenWhat it actually meansMeant
    en-UKInvalid — UK is reserved, not an assigned region codeen-GB
    ukUkrainian, any regionen-GB if you meant British English
    seNorthern Samisv or sv-SE for Swedish
    jpInvalid — a country, not a languageja or ja-JP
    czInvalid — a country, not a languagecs or cs-CZ
    dkInvalid — a country, not a languageda or da-DK
    grInvalid — a country, not a languageel or el-GR
    cnInvalid — a country, not a languagezh-CN
    es-LAInvalid — LA is Laos, and “Latin America” has no ISO 3166-1 codees, or one row per country such as es-MX
    CAInvalid — a region with no languageen-CA and fr-CA

    Common correct values, for reference: en-US, en-GB, en-AU, en-CA, es-ES, es-MX, fr-FR, fr-CA, de-DE, de-AT, de-CH, it-IT, pt-BR, pt-PT, nl-NL, nl-BE, ja-JP, ko-KR, zh-CN, zh-TW — and x-default for the fallback.

    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.

    What is an hreflang tag?

    A <link rel="alternate" hreflang="…"> line in a page’s <head> (or the same information in an HTTP header or a sitemap) that names the other language or regional versions of that page. Google and Bing use it to show each searcher the version in their language. It is a hint about which version to show, not a ranking signal.

    Do I need hreflang on every page?

    On every page that has a translated or regional equivalent, yes — and on each version of it, not only the original. A page with no other-language version needs no hreflang at all.

    What does x-default mean?

    The page to show a visitor whose language matches none of the versions you listed — usually a language chooser or your main international page. It is optional, and a set has one at most.

    How do I check my hreflang tags are working?

    View each page’s source and confirm the full set is there, including the page itself and a link back from every other version. This generator checks the codes and addresses you type; it does not fetch your pages, so it cannot confirm the tags are live or reciprocal.

    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 what a non-rendering crawler receives — status, title, main heading and word count — and whether your page arrives empty until its scripts run. Render Check does not list hreflang tags; for those, view the page source.