Search tools

Hreflang Tag Generator

List each language version of a page and get correct hreflang annotations in the format you need.

Hreflang Tag Generator tool

Language versions of one page — include the page itself

    Processing runs in your browser.

    If your site has the same content in several languages, or tailored versions for different countries, search engines need to know they belong together. Otherwise your Australian pricing page might show up for searchers in the US, or your German page might compete with your Austrian one. Hreflang annotations link the versions together and say which audience each one is for.

    How the codes work

    Each code starts with a two-letter language (ISO 639-1), optionally followed by a region (ISO 3166-1):

    • en — English for everyone.
    • en-GB — English for the United Kingdom.
    • es-419 — Spanish for Latin America, using a UN region number.
    • zh-Hant — Chinese in traditional script.

    You can mix general and specific codes, for example de for all German speakers plus de-CH for Switzerland.

    Choosing a format

    • HTML tags are easiest for small and medium sites. They go in the <head> of every version.
    • XML sitemap entries keep your HTML lighter and are easier to manage for large sites with many languages.
    • HTTP headers are for PDFs and other files without HTML.

    Use one method per page; mixing them makes errors harder to find.

    A common mistake

    The most frequent error is missing return links: the English page lists the French one, but the French template was never updated. Generate the full set once and paste the same block into every version, so the annotations always match.

    How to use the Hreflang Tag Generator

    1. Enter a language code and URL for each version of the page, including the current one.
    2. Choose codes from the suggestions, like en-GB, es-MX or de.
    3. Add an x-default URL for visitors whose language isn’t listed.
    4. Pick the output format: HTML tags, XML sitemap or HTTP header.
    5. Copy the output and add it to every version of the page.

    Features

    • Three output formats: link tags, sitemap xhtml:link entries and Link headers.
    • Validates language and region codes, including the common en-UK mistake (the code is en-GB).
    • Supports script codes like zh-Hans and region numbers like es-419.
    • Warns about duplicate codes, relative URLs and a missing x-default.
    • Suggestions for over 30 common language and region codes.

    Frequently asked questions

    What does hreflang do?

    It tells search engines which language or regional version of a page to show each searcher. A visitor in Mexico searching in Spanish gets your es-MX page instead of the Spanish page for Spain.

    Does every version need the tags?

    Yes. Hreflang must be reciprocal: each version lists all the others and itself. If page A points to B but B doesn’t point back, search engines may ignore the pair.

    What is x-default?

    It is the fallback page for visitors whose language or region doesn’t match any version, often a language picker or your main international page.

    Can I use a country code alone, like hreflang="uk"?

    No. The first part must be a language. uk is Ukrainian, not the United Kingdom. For English in the UK, use en-GB.

    Written by