Free generator, runs in your browser
Hreflang Tag Generator for HTML, headers and sitemaps
List the language and region versions of a page and get correct hreflang annotations in the format you need. Every code is validated and common mistakes, such as en-UK, are caught.
Generate hreflang
Add each version of the page. The annotations update as you type.
Why use the Hreflang Generator
Three formats
HTML link tags for the head, an HTTP Link header for PDFs and other files, and xhtml:link entries for an XML sitemap.
Validated codes
Language codes are checked against ISO 639-1 and regions against ISO 3166-1, with a suggestion for common mistakes.
x-default
Add the fallback page for visitors whose language you do not serve.
Private
Everything runs in your browser.
When to use the Hreflang Generator
Multilingual sites
Connect the English, German and French versions of every page.
Regional stores
Separate en-US, en-GB and en-AU pages that differ by price or spelling.
Language selectors
Point x-default at the page that lets visitors pick a language.
Large sites
Move annotations into the sitemap instead of every page head.
PDF documents
Annotate files without a head with the HTTP Link header.
Migrations
Rebuild annotations after a change of url structure.
Understanding Hreflang
How to use the generator
- 1Versions. Add one row per version: its language code and its absolute url.
- 2x-default. Optionally add the page for everyone else.
- 3Format. Choose HTML, HTTP header or XML sitemap.
- 4Publish on every version. Each version must list all versions, itself included. The output is the same for all of them.
The codes
A code is a language, optionally followed by a region: en, en-GB, pt-BR, zh-Hant. The language uses ISO 639-1 and the region ISO 3166-1 alpha-2. A region alone, such as us, is not valid. The United Kingdom is GB, not UK.
Common mistakes
Missing return links, where page A points to B but B does not point back, make search engines ignore the pair. So do relative urls, urls that redirect, and urls blocked by robots.txt or marked noindex. Use one method per page set: tags, headers or the sitemap.
Privacy
The generator runs entirely in your browser. Nothing you type is sent to Aback or anywhere else, and your last input is kept in this browser so a reload does not lose it.
Related tools and guides
Frequently asked questions
What is hreflang?
An annotation that tells search engines which language and region each version of a page is for, so they show people the right one.
Do I need x-default?
It is optional but recommended. It names the page for visitors whose language or region you do not target.
Should a page reference itself?
Yes. Every version lists every version, including itself.
Is it en-UK or en-GB?
en-GB. The region code for the United Kingdom in ISO 3166-1 is GB.
Which format should I use?
HTML tags for most sites, the sitemap for large sites with many versions, and the HTTP header for files such as PDFs.
Does Bing use hreflang?
Bing prefers the content-language meta tag and the lang attribute, but also reads hreflang. Use both.
How do I check the live annotations?
Run the hreflang checker on one of the versions. It validates the codes and the return links.