Free Hreflang Tag Generator
Build hreflang tags for HTML, XML sitemaps or HTTP headers, or paste an existing set to check it. No sign-up required.
Your language versions
Shown to anyone whose language matches none of your versions. Usually your global or English page.
HTML head tags
Paste into the <head> of every page in the set.
<link rel="alternate" hreflang="en-US" href="https://example.com/" /> <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" />
Correct tags stop the wrong page ranking. They do not create demand.
Once each market sees the right version, the question is whether it ranks at all. RankSpot finds the keywords each of your markets can win, then researches and publishes content to target them.
Try RankSpot freeHow to create hreflang tags
This hreflang generator builds the complete reciprocal set for every language version you list, in whichever of the three valid formats you need. Everything runs in your browser.
1. List your language versions
One row per translated or regional page, with its language and optional country. Add an x-default for anyone whose language matches none of them.
2. Pick where the tags go
HTML head tags, XML sitemap markup or an HTTP header. All three are valid, and the right one depends on how many pages you have and what type they are.
3. Or check tags you already have
Paste an existing set and it flags invalid codes, duplicates, relative URLs and the classic en-UK mistake before Google quietly ignores them.
An hreflang example, and the rule people miss
A site with English, French and German versions needs this on every one of those three pages, not just on the home page:
<link rel="alternate" hreflang="en-GB" href="https://example.com/" /> <link rel="alternate" hreflang="fr-FR" href="https://example.com/fr/" /> <link rel="alternate" hreflang="de-DE" href="https://example.com/de/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
Two things in that hreflang example trip people up. The set includes a self-referencing tag: the English page lists itself. And the identical block goes on all three pages. If the German page omits the French one, Google treats the relationship as unconfirmed and discards it. Missing return tags are the single most common reason hreflang silently does nothing.
The hreflang tag checker above validates codes, duplicates and URL format, but it cannot verify reciprocity, because that means fetching every page in the set. It says so rather than implying a clean result means the implementation is correct.
Hreflang country codes, and the en-UK trap
The value is an ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha-2 country code. Language first and required, country second and optional. The hreflang country codes half is where implementations break, because the codes look guessable and are not:
- en-UK is invalid. The country code for the United Kingdom is GB, so it is en-GB. This is easily the most common hreflang error, and Google does not treat it as a near miss: the tag is ignored outright.
- en-EU is invalid. The second half must be a country, and the EU is not one. There is no way to target a continent with hreflang.
- Order matters. It is language then country. GB-en is not a valid value.
- Country alone is not allowed. You cannot write just DE to mean Germany. Use de, or de-DE.
Hreflang on WordPress and other CMSs
If you use a multilingual plugin, hreflang wordpress setups are usually already handled: WPML, Polylang and TranslatePress all emit the tags automatically once your translations are linked to each other. Adding a second hardcoded set on top is a common way to create conflicting declarations, so check what is already in your page source first.
Without a plugin, you can add the tags to your theme header, but a hardcoded set stops being correct the moment you add a language and forget to update every template. For anything beyond a handful of pages the XML sitemap format is easier to maintain, since the whole set lives in one file.
Frequently asked questions
What is an hreflang tag used for?
How do I add hreflang?
What is hreflang x-default and do I need it?
What language and country codes does hreflang use?
Why is en-UK wrong?
Do hreflang tags need to be reciprocal?
How do I add hreflang tags in WordPress?
Where do hreflang tags go: head, sitemap or HTTP header?
Does hreflang improve rankings?
How do you pronounce hreflang?
Millions of people will ask AI about your category this week
RankSpot researches, writes and publishes daily, and sends you the short list of what's left. Free for 3 days.
Start free trial
