CanonicalTag.com logoCanonicalTag.comThe canonical tag & URL canonicalization
Free canonical tool

Hreflang Tag Generator

Enter each language or region version of a page and get the full, reciprocal set of hreflang link tags — the same block you add to every URL in the set. hreflang and canonical tags work together, so getting both right matters.

Use values like en, en-us, es-419, or x-default. This tool runs entirely in your browser — nothing you enter is sent to our server, so nothing is saved.

How hreflang and canonical tags work together

The hreflang attribute tells search engines that several URLs are the same page for different languages or regions, so the right version is served to the right audience. It only works when it is reciprocal: every URL in the set must list all the others, including itself. Add the generated block to the <head> of every page in the set (or return it in an HTTP header or XML sitemap).

The critical rule where canonicalization is concerned: each page in an hreflang set must carry a self-referencing canonical — a canonical that points to its own URL, not to another language. A canonical that points across languages contradicts hreflang, and search engines may then ignore both signals. See the guide on canonical tags vs hreflang for the full explanation, and use the Canonical Tag Generator to build the matching self-referencing canonical for each page.

x-default

The x-default value marks the fallback URL for users whose language or region you do not specifically target. It is optional but recommended for most international sites.

Privacy

This tool is entirely client-side. The codes and URLs you enter are processed in your browser and are never transmitted to or stored on our server.

Frequently asked questions

Do I add the hreflang tags to one page or all of them?

The same block goes on every URL in the set. hreflang must be reciprocal: each page links to all the others, including itself.

What is x-default?

The fallback URL for users whose language or region you do not specifically target. It is optional but recommended for most international sites.

Does hreflang replace the canonical tag?

No. Each page in an hreflang set still needs a self-referencing canonical; a canonical that points across languages contradicts hreflang.

Is the hreflang generator private?

Yes. It runs entirely in your browser, so the codes and URLs you enter are never sent to or stored on our server.