Hreflang Tag Generator
Add one row per language version with its code and full URL. Pick an x-default page and copy the link tags for your head or a sitemap with alternates.
- Add a language code and URL for each version
- Choose the x-default page
- Copy the tags or the sitemap
Your files never leave your device
How to build hreflang tags
Hreflang annotations tell search engines which language or regional version of a page to show to which visitors. Add one row for each version with its language code and its full address, choose the page that serves everyone else as x-default, and copy the result. You can output link tags for the head of the page or a sitemap with alternates.
- Every page must list all its alternates, including itself, and each alternate must link back.
- Use ISO 639-1 language codes, optionally with a region such as pt-BR. Use full, absolute URLs.
- x-default marks the page shown to visitors whose language is not covered.
A worked example
A site has three versions of its home page: English at https://example.com/, French at https://example.com/fr/ and German at https://example.com/de/. Add the codes en, fr and de with those addresses and choose the English page as x-default. The output contains four link tags in the same block: one for each language and one with hreflang set to x-default.
Paste the same block into the head of all three pages. The French page needs the English and German lines too, plus a line for itself, which is the rule that every version lists all the others.
Common mistakes
Missing return links are the most common problem. If the English page points to the French one but the French page does not point back, search engines may ignore the annotation. Another frequent mistake is a relative address such as /fr/ instead of the full URL, or a code that is not a valid language tag.
Only add a region when you really have separate versions for regions, for example en-GB and en-US. If a row is marked invalid, check the code, the URL and make sure the same code is not used twice.
Frequently asked questions
What does hreflang do?
It tells search engines which language or regional version of a page to show to which users, which helps avoid showing the wrong language.
Do I need a region code?
Only when you have different versions for regions, such as en-GB and en-US. Otherwise the language code alone is enough.
Which format should I choose?
Link tags in the head are simplest. A sitemap is easier for large sites because the annotations stay in one file.
Why is a code marked invalid?
The code is not a valid language or region tag, a URL is not absolute, or the code is repeated.
Do alternates need to point back?
Yes. Each version must list the others, otherwise the annotations may be ignored.
Is anything uploaded?
No. The tags are built on your device and your addresses are never sent anywhere.