See if ChatGPT recommends you. Free, 60 seconds.
Free SEO Tool

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/" />
The same complete set goes on every page listed, including a tag pointing at the page itself. If one page omits the others, Google ignores the whole set.

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 free

How 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?
It tells Google that several pages are the same content in different languages or for different countries, so it can show each searcher the right one. Without it, Google may serve your German page to a British visitor, or treat your US and UK pages as duplicates and pick one. It does not change rankings, it changes which version of a page ranks.
How do I add hreflang?
Three options, all equally valid to Google. Put link tags in the head of every page, list the alternates in your XML sitemap, or send them as an HTTP Link header. Head tags are simplest for a handful of pages, sitemaps scale better for hundreds, and headers exist for non-HTML files like PDFs. The generator above outputs all three.
What is hreflang x-default and do I need it?
The hreflang x-default value marks the page to show someone whose language and country match none of your versions. It is optional but worth adding: without it, a visitor from a country you have not targeted gets whichever page Google guesses at. Usually the x-default points at your global or English page, or a language selector if you have one.
What language and country codes does hreflang use?
An ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha-2 country code, as in en or en-GB. The language comes first and is required, the country is optional and must be a country. This is the single most common source of broken hreflang, because the codes look guessable and are not.
Why is en-UK wrong?
Because UK is not the ISO country code for the United Kingdom. GB is. Google does not interpret en-UK as a near miss, it treats the tag as invalid and ignores it, which means the page it pointed at never gets served to British searchers. The checker above flags this one by name, along with es-LA and en-EU, which are wrong for the same reason: LA and EU are not countries.
Do hreflang tags need to be reciprocal?
Yes, and this is where most implementations fail. Every page in a set must list every other page, including a tag pointing at itself. If your French page lists the English one but the English page does not list the French one, Google discards the relationship entirely. The tool above generates the full reciprocal set, but confirming it on a live site needs a crawler that can fetch each page.
How do I add hreflang tags in WordPress?
If you run a multilingual plugin such as WPML, Polylang or TranslatePress, it generates hreflang tags automatically once your translations are linked, and you should not add them by hand as well. Without such a plugin you can insert the tags into your theme's header, though a hardcoded set breaks as soon as you add a language. Check what your plugin already outputs before adding anything.
Where do hreflang tags go: head, sitemap or HTTP header?
Whichever suits your site, since Google treats all three equally. Use head tags when you have a few pages and can edit templates. Use the XML sitemap when you have many, because the whole set lives in one file rather than being duplicated into every page. Use the HTTP header for PDFs and other files that have no head to put tags in. Do not use more than one method for the same page, since conflicting declarations cause more problems than they solve.
Does hreflang improve rankings?
Not directly. It has no effect on how highly a page ranks, only on which of your language versions is shown for a given searcher. The practical benefit is real though: serving the right version improves click-through and reduces bounces, and it stops your own pages competing with each other in the same results.
How do you pronounce hreflang?
It is usually said as H-ref-lang, since it comes from HTML's href attribute plus lang. It is not an acronym and there is no official pronunciation. Nobody will mind either way.
Start free today

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