1. Home
  2. Productivity tools
  3. Hreflang Tag Generator

Hreflang Tag Generator

For international sites that need to tell search engines which page is meant for which language and region.

Free, no sign-up. Runs in your browser: nothing is uploaded.

Free workspace included. Docs, spreadsheets, notes and tasks that save on your device. No sign-up.Take a look

How to use Hreflang Tag Generator

  1. Fill in the form, or press a sample to see a worked example.
  2. Read the result and any warnings about problems it found.
  3. Copy the output or download it as a file.

Features

  • HTML link tags, an HTTP Link header or XML sitemap entries
  • Validates language, optional script and region codes such as en-GB and zh-Hant
  • Supports x-default for the fallback page
  • One line per language version, so every page gets the full set
  • Flags duplicate languages and bad addresses

Supported formats

Input

  • Typed language and address pairs

You get

  • HTML tags
  • HTTP header
  • XML sitemap entries

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Hreflang Tag Generator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • It cannot check the live pages for return links; every page in the set must carry the full list.
  • Codes are checked against the language-script-region pattern, not against a list of regions search engines accept.

Guide

Marking language and region versions with hreflang

When the same content exists in several languages, or in one language for several countries, search engines must decide which version to show a searcher. The hreflang annotation tells them. It does not rank pages higher; it helps the right version appear for the right person and avoids having the versions treated as duplicates. The format is easy to get subtly wrong, and this generator writes it from a short list.

Entering your versions

Each line holds a code, a bar and the full address of that version, for example en-GB | https://shop.example/uk/. The first column is a language code such as en, optionally followed by a script and a region, as in zh-Hant, pt-BR or en-GB. The word x-default is also accepted. The tool checks each code against this pattern and each address for a full http or https form, and flags duplicate codes and other mistakes by line number. A bar, a tab, a comma or a space may separate the two columns.

Three ways to publish the same facts

Choose what to show. HTML link tags go in the head of every version and are the easiest for small sites. An HTTP Link header carries the same information for files that have no HTML head, such as PDFs. Sitemap entries put the alternates inside the XML sitemap, with an xhtml:link element for every version inside each url block, which suits large sites because pages stay lighter. The fourth option prints all three.

Why the set must be complete

Each page must list every version, including itself. If the English page points to the German one but the German page does not point back, search engines may ignore the pair. The output is therefore one block that you place on every page of the set, unchanged. That is why the tool asks you to enter the whole set once rather than one page at a time.

Country codes that trip people up

The language comes first, then the region. English for the United Kingdom is en-GB, never en-UK, because GB is the region code for the United Kingdom. The tool expects the usual writing, lower-case language and upper-case region, and rejects en-gb or a region alone such as GB. It also warns when no x-default line is present.

A worked example

The sample has five lines: en for the home page, en-GB for /uk/, fr-FR for /fr/, de for /de/ and x-default pointing to the home page. The tool reports 5 versions and prints five link tags, such as <link rel="alternate" hreflang="fr-FR" href="https://shop.example/fr/" />. In sitemap form it prints a url block for each of the four distinct pages, each containing all five xhtml:link lines, and a note says to add the xhtml namespace to the urlset element.

Limits

The tool formats annotations. It does not fetch your pages, so it cannot confirm that each version exists, that the return links are in place or that the language of the content matches the code. Search engines may also ignore hreflang when a page is blocked, redirected or marked as a duplicate of another. After publishing, test a sample of pages with a crawler or Search Console.

Checked against the current version of the Hreflang Tag Generator on .

Frequently asked questions

Do I need hreflang for two pages in the same language?

Only if they target different regions, such as US and UK English pages with different prices or spellings. If one version suits everyone who speaks the language, a single page and no annotation is simpler and avoids mistakes.

What does x-default do?

It names the page for visitors whose language or region matches none of your versions. It is often a language chooser or the main international page, and it can point to the same address as one of your language versions.

Why do hreflang pages need return links?

Every page in the set must point to all the others, itself included. If page A names page B but B does not name A, search engines may ignore the annotation.

Is en-UK a valid code?

No. The region for the United Kingdom is GB, so the code is en-GB. The tool flags codes that do not match the language-region pattern.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.