Utilia

Hreflang Tag Generator

Generate hreflang tags for multilingual pages as HTML link tags, XML sitemap entries or HTTP Link headers, with ISO code and reciprocity checks.

Language versions e.g. en, en-CA, fr-CA, zh-Hant
Put the same complete set on every page listed, including the page itself.

Checks

Check a page's existing tags

Paste the hreflang tags, sitemap entries or Link header currently served by one of your pages to compare them with the set above.

How to use the hreflang generator

  1. Under Language versions, enter one row per version of the page: a Language code such as en, en-CA or fr-CA, and the absolute Page URL of that version. Use Add a language for more rows.
  2. Optionally fill in the x-default URL, the page shown to visitors whose language matches none of your versions.
  3. Choose the Output format: HTML link tags, XML sitemap or HTTP Link header.
  4. Read the Checks, then Copy or Download the code. Place the same complete set on every page listed.
  5. To audit a live page, open Check a page’s existing tags, paste what the page currently serves and enter its URL. The tool lists missing, extra and mismatched entries.

Load example shows a four-version English and French setup with an x-default.

What hreflang does

hreflang tells search engines that several URLs are versions of the same content for different languages or regions, so each searcher is shown the right one. It doesn’t change rankings and doesn’t redirect anyone; it only helps Google and Yandex pick which version to show in results. Bing mostly relies on the content-language meta tag and the lang attribute instead.

Each value is a language code from ISO 639-1 (two letters, such as de), optionally followed by a region from ISO 3166-1 alpha-2 (such as AT for Austria). A script such as zh-Hant is also accepted. The region can’t be used alone: CA means Catalan, not Canada. For Canadian French, write fr-CA. This tool validates both parts against bundled code lists, writes them in the usual case (en-US, even if you type EN_us), and catches classic mistakes such as en-UK (the United Kingdom is GB) or withdrawn codes like iw for Hebrew (now he).

The three output formats

  • HTML link tags go in the <head> of every version. It’s the simplest option for normal web pages.
  • XML sitemap puts the annotations in your sitemap instead: one <url> entry per page, each listing every alternate with xhtml:link. It keeps the HTML light and is easier to manage for large sites.
  • HTTP Link header is for files without a <head>, such as PDFs. Your server sends the header with the file.

Use one method per page. Mixing them is allowed but makes mistakes more likely.

Reciprocity: the rule most sites miss

Annotations must be bidirectional. If page A says that B is its French version, B must also point back to A, or search engines ignore the pair. Each page must also list itself. The simplest way to get both right is to output the exact same block on every version, which is what this tool generates. The Check a page’s existing tags panel compares one page’s current tags with your set and reports missing return links, a missing self-reference, and URLs that differ, for example because of a trailing slash or http instead of https.

Frequently asked questions

Is x-default required?

No, but it is recommended. It names the fallback page for everyone else, typically a language selector or your main version. It must follow the same rules as the other entries, including being listed on every page.

Should I add a generic language as well as regional ones?

Usually yes. If you only have en-GB and en-US, an English speaker in Ireland matches neither. Adding a plain en version covers them, and this tool warns when a language has only regional variants.

Can two languages point to the same URL?

Yes. For example, en-GB and en-IE may share one page when the content is identical. Each hreflang value, however, must appear only once in the set.

Do the URLs have to be absolute?

Yes. Google requires fully qualified URLs, including https://. Relative paths are rejected here. A fragment such as #top is ignored by search engines.

Does hreflang replace the canonical tag?

No, they work together. Each version should have a canonical pointing to itself, not to another language version. A canonical to a different language tells Google to drop that page, and its hreflang is ignored.