Hreflang Generator

Generate reciprocal language annotations as HTML tags, an HTTP Link header or per-site XML sitemaps.

One set of equivalent pages

Enter one language code, a space and the full page URL on each line. For example: en https://example.com/en/guide/. Use translations or regional versions of the same content, not unrelated pages. At least two non-default variants are required. Each language code may appear once; x-default is optional. The tool preserves the supplied order and normalizes code casing.

Choose one delivery method

HTML produces an identical set of alternate links to place in every variant’s head, including its own reference. HTTP produces one Link response-header value for every variant; configure it as a response header, not a meta tag. Choose a delivery method you can maintain across all equivalent pages.

XML adds all alternates to each unique URL entry. When the input spans origins, the output selector provides a separate sitemap for each origin so its loc entries belong to that site. Every file still includes the full cross-domain alternate set. Download each file and host it at its listed origin, preferably at the site root; the tool does not upload or submit it. Duplicate URLs, such as an English page also used for x-default, receive one loc entry.

Language codes that match the intended audience

Use an ISO 639-1 language, optionally a registered script and ISO 3166-1 alpha-2 region: en, en-GB, zh-Hans, zh-Hant or zh-Hans-US. Underscores, three-letter languages, numeric regions such as es-419, and reserved region values such as UK or EU are rejected. A language alone can be valid: be means Belarusian, not Belgium.

Validation uses a bundled IANA registry snapshot dated 2026-09-17, filtered to the Google-compatible subset. No registry request is made while typing. x-default identifies a fallback for unmatched users; it is not a language code. Supply it deliberately rather than redirecting every language to one canonical URL.

Deployment checks that still matter

The generator ensures complete annotation sets from your input. It does not verify page translations, crawlability, HTTP status, live return links, canonical conflicts or search results. Use real published, indexable equivalents with a suitable canonical for each language, then check the deployed pages. Input is limited to 200 rows, 200,000 UTF-16 units overall and 8,192 encoded characters per URL. URLs must be absolute HTTP/HTTPS, without credentials or fragments. XML loc URLs must be shorter than 2,048 characters after URL serialization; output is limited to 50 MiB per file and 64 MiB overall.

Questions & answers

Do I need a different HTML block for each version?

No. Put the same complete block on every equivalent page, including the current page itself. A missing return link can break the relationship.

Can different domains be in the same set?

Yes. HTML and HTTP output include them directly. XML output splits loc entries into one file per origin while retaining cross-domain alternate links in every file.

Does this detect a page’s language or guarantee indexing?

No. You choose the language and equivalent URLs. The tool makes no network requests and cannot establish whether a page is translated, indexable or used by a search engine.

Other Languages

References

How we make sure

We check this tool with the automated test suites linked below. Example checks are shown in their original language.

Verification method
Inspect generated HTML/headers/XML and check canonical/alternate/sitemap fields, reciprocal links, escaping and duplicates.
Comparison reference
Explicit metadata expectations, XML namespaces and fixed language/region registry data.
Verification scope
Correct formatting does not guarantee search-engine indexing or ranking.
Test source and cases (select a file to read it)
  • seo-tools.test.js
    • Hreflang normalizes casing while retaining explicit scripts and ISO country codes
    • Hreflang HTML includes self and every alternate exactly once, including shared x-default

These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.