Hreflang tag generator
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.
01
List the versions
A language code, a space and the URL, one version per line.
02
Add an x-default
Optional: the page for visitors whose language is not listed.
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
| Code | Valid? | Why |
|---|---|---|
| en | Yes | English, any region |
| en-GB | Yes | English for the United Kingdom |
| en-UK | No | UK is not the ISO code; Google ignores it. Use en-GB |
| jp | No | jp is a country code; Japanese is ja |
| GB | No | A region on its own; it needs a language first |
| x-default | Yes | The 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?
Why is en-UK wrong?
Does every version need the tags?
What is x-default for?
Link tags or sitemap: which is better?
Related tools
XML Sitemap Generator
A valid sitemap.xml from a list of URLs
Open itMeta Tag Generator
Title, description, canonical and sharing tags in one block
Open itLocal Business Schema Generator
LocalBusiness JSON-LD from your business details
Open itSERP Preview Tool
See where a title and description will be cut
Open itRobots.txt Generator
A clean robots.txt from the paths you want blocked
Open itRobots.txt Tester
Which rule allows or blocks a URL, and why
Open it