hreflang Tag Generator - HTML, Sitemap & HTTP Header Annotations

AdSense Placeholder
Slot: header_tool

hreflang Tag Generator

Tell search engines which language version to show to which visitor

    AdSense Placeholder
    Slot: tool_mid_article

    Three Output Formats

    HTML link tags for the head of each page, XML sitemap entries for many pages, or an HTTP Link header for files like PDFs.

    Codes Checked

    Codes such as en-GB and zh-Hant-TW are checked against the ISO lists, normalised to the usual case, and mistakes like en-UK are explained.

    Full Set, Self-Referencing

    Every page must list all versions including itself. The output is that full list, ready to paste on each one.

    Full Privacy

    Everything is built in your browser.

    How hreflang Works

    When a site has the same page in several languages or for several countries, hreflang annotations tell search engines which version belongs to which audience, so a Spanish speaker in Mexico sees the es-MX page and not the English one. Each version lists every version, itself included, in the form , and the annotations must be reciprocal: if page A points to B, B must point back to A.

    The language is a two-letter ISO 639-1 code, optionally followed by a script and a region: en, en-GB, zh-Hant, zh-Hant-TW. Regions use ISO 3166-1 codes, so the United Kingdom is GB, not UK. The special value x-default marks the fallback for visitors whose language you do not cover. Use absolute URLs, keep them consistent with your canonical URLs, and remember that a region alone (such as "GB") is not a valid value.

    Key Takeaways

    • Reciprocal: Paste the same full set on every language version.
    • Sitemap option: For large sites, the sitemap form keeps annotations out of your page templates.
    • Related tools: See also the Meta Tag Generator and the robots.txt Generator.
    AdSense Placeholder
    Slot: footer_leaderboard