ToolsWhisper
SEO tools

Hreflang Tag Generator

Build hreflang annotations for multilingual pages, with language codes validated.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up
Language versions of one page
  • This URL is already used by row 1. Each language version should have its own URL.

Output
Add inside <head> on every version

The same block goes on every language version, including the page itself. Each page must list all the others and itself; if one side of a pair does not link back, Google ignores the annotation.

About this tool

List each language or regional version of a page with its URL, and get the hreflang annotations in whichever form suits your site: link tags for the HTML head, an HTTP header, or XML sitemap entries. Codes and URLs are checked as you type, so the usual mistakes show up before they ship.

How to use it

  1. Add a row for every version, including the page itself, with its language code and full URL.
  2. Add an x-default row for visitors whose language is not listed.
  3. Choose HTML, HTTP header or sitemap output and copy it into every version.

What hreflang does, and what it does not

hreflang tells Google that several URLs are the same page for different languages or regions, so it can show each visitor the right one. It prevents a French searcher being sent to your English page, and keeps your translations from being treated as duplicates of each other.

It is a hint, not a command, and it is not a ranking factor: it does not make a page rank higher, only helps the right version appear. It is read by Google and Yandex. Bing's documentation points to the page's lang attribute and Content-Language instead.

The rules that break it

Most hreflang that does not work breaks on one of these:

  • Every version must list every version, including itself. If page A points to B and B does not point back, the pair is ignored. That is why the same block goes on all of them.
  • URLs must be absolute, with the scheme, such as https://example.com/fr/.
  • Each version should be its own canonical. A French page whose canonical tag points at the English one tells Google to ignore the French page.
  • One URL per language-and-region code. The same code cannot appear twice.
  • The codes must be valid. Google silently ignores a bad one.

Language and region codes

A code is a language in lower case (ISO 639-1: en, fr, ar), optionally followed by a region in capitals (ISO 3166-1: en-GB, fr-CA) or a script and region (zh-Hant-TW). A region on its own, such as GB, is not valid.

Often written Correct Why
en-UK en-GB The United Kingdom's ISO code is GB
jp ja jp is the country; the language is ja
cn zh or zh-CN cn is the country; the language is zh
en_US en-US A hyphen, not an underscore

Use a plain en for English-language readers anywhere, and add en-GB or en-AU only when the pages genuinely differ.

HTML, header or sitemap?

HTML link tags in the head are simplest for a few languages. An HTTP header is the only option for files with no head, such as PDFs. A sitemap keeps the annotations out of the page, which matters when each page would otherwise carry dozens of tags.

Pick one method per site. Mixing them invites contradictions. To build the sitemap itself, see the XML sitemap generator, and for the page's other head tags the meta tag generator.

Frequently asked questions

Do I need an x-default entry?

It is optional but recommended. It names the page to show visitors whose language does not match any other entry, typically a language chooser or your main version.

Does the block go on every page?

Yes. Every version carries the identical set of annotations, including a line pointing to itself.

Can the versions be on different domains?

Yes. hreflang works across domains and subdomains, as long as each version links to the others and back.

Should I use it for pages that are only regionally different?

Yes, when you have near-identical content for different countries, such as en-US and en-GB pages with different prices. That is one of its main uses.

Related tools