Skip to content
Koit Academy

Hreflang tag generator

Your details

The page for everyone else: usually the main version or a language chooser.

The details filled in are an example. Everything runs in this browser; nothing you type is sent anywhere or stored.

Link tags for every version

4 language versions plus x-default.

<link rel="alternate" hreflang="en" href="https://www.example.com/">
<link rel="alternate" hreflang="en-GB" href="https://www.example.com/uk/">
<link rel="alternate" hreflang="de" href="https://www.example.com/de/">
<link rel="alternate" hreflang="fr-FR" href="https://www.example.com/fr/">
<link rel="alternate" hreflang="x-default" href="https://www.example.com/">
  • Note: Put the same 5 lines in the head of every one of the 4 pages. Each page has to list itself and all the others, or Google ignores the set.

How to use it · free, no signup

How to use the Hreflang Tag Generator

Enter each language version and its URL to get the hreflang tags every version needs, or the same set as sitemap entries, with codes checked against ISO lists. Runs in your browser.

  1. 01

    List the versions

    A language code, a space and the URL, one version per line.

  2. 02

    Add an x-default

    Optional: the page for visitors whose language is not listed.

  3. 03

    Copy the set

    Into the head of every version, or as sitemap entries.

One set of tags, on every version

hreflang tells search engines which pages are versions of each other, and which language or region each serves. The rules that trip sites up are set out in Google’s guide to localized versions: each version must list itself as well as every other version, the annotations must be reciprocal, and if two pages do not point to each other the tags are ignored. In practice that means the same block of tags goes into the head of every version.

Codes that work and codes that do not

CodeValid?Why
enYesEnglish, any region
en-GBYesEnglish for the United Kingdom
en-UKNoUK is not the ISO code; Google ignores it. Use en-GB
jpNojp is a country code; Japanese is ja
GBNoA region on its own; it needs a language first
x-defaultYesThe fallback version

The first part is an ISO 639-1 language code, optionally followed by an ISO 3166-1 alpha-2 region code. The generator checks both against the full lists and suggests the right language code for the common mix-ups.

Mistakes the generator catches

  • Relative URLs. hreflang needs the full address, with https://.
  • Duplicate codes. One code can point to one page only.
  • A single version. hreflang links alternatives, so it needs at least two.
  • Missing return links. The generator cannot see your pages, so it reminds you that every version needs the full set.

Tags or sitemap

For a handful of pages, link tags in each page’s head are the simplest. For many, the sitemap format puts the whole set in one file. To build a plain sitemap first, use the XML sitemap generator; for the business details on each regional site, the local business schema generator.

Published by Koit Academy. Who runs it, how it is paid and how its tools are checked.

Questions

What people ask about the Hreflang Tag Generator

What is hreflang?
An annotation that tells search engines a page has versions in other languages or for other regions, so each searcher can be shown the right one.
Why is en-UK wrong?
UK is not the ISO code for the United Kingdom; GB is. Google says UK, EU and UN in hreflang have no effect, so en-UK is ignored. Use en-GB.
Does every version need the tags?
Yes. Each version must list itself and every other version. If two pages do not point to each other, Google ignores the annotations.
What is x-default for?
The version to show when no listed language or region matches, often the main site or a language chooser. It is optional.
Link tags or sitemap: which is better?
Either works, and they carry the same information. Tags are simpler for a few pages; a sitemap is easier to manage when there are many.