Add one row for every language version of the same page, including the page you are putting the tags on.
Hreflang tells search engines that several URLs are the same page written for different languages or regions, so the right version is shown to the right visitor. It is not a ranking signal and it does not stop the pages competing with each other in the way a canonical tag does. What it does is swap the result in the listing when the searcher's language or country matches one of the versions you have declared.
The rule that catches most people out is reciprocity. Every URL in the set has to carry the full set of tags, including one pointing at itself. If page A links to B but B does not link back to A, search engines discard the annotation entirely. Language codes follow ISO 639-1 and region codes follow ISO 3166-1 alpha-2, so en-GB is valid and en-UK is not. This tool builds both the head tag form and the HTTP Link header form.
How to use the Hreflang Tag Generator
- Add one row for every language version of the page, including the page the tags will go on.
- Paste the absolute URL for each version and pick its language, adding a region code only when you actually target a specific country.
- Add an x-default row pointing at the version to show visitors whose language matches nothing in the set.
- Click Generate Tags, switch between the HTML and HTTP Link header tabs, then copy the block into the head of every page in the set.
Frequently asked questions
Does every page need a self referencing hreflang tag?
Yes. The set of tags has to be identical on all pages in the group and must include a tag pointing at the page you are on. Search engines use the self reference to confirm the page belongs to the set, and they drop annotations that are not confirmed from both sides.
What does x-default do?
It names the fallback URL for users whose language or region does not match any version you have declared. A common choice is a language selector page or the English version. It is optional, but without it visitors outside your targeted markets are matched by guesswork.
Can I use a region code on its own?
No. The value must start with a language code in ISO 639-1 form. A region alone, such as GB, is invalid and ignored. You can use a language without a region, like en, but never a region without a language. Region codes come from ISO 3166-1 alpha-2.
Should I use head tags, HTTP headers or the sitemap?
Any one of the three, but only one, and never mixed for the same set. Head tags suit HTML pages. HTTP Link headers are the only option for non HTML files such as PDFs. Sitemap annotations keep the markup out of the page and scale better on large sites.