Free tool
Hreflang tag generator
Every language or country version of a page has to name all the others, itself included, or Google can ignore the tags. Paste the versions, one per line, and this makes the full set in the form your site can carry, with each code checked against the ISO lists on the way. Nothing you type leaves your browser.
The tags
Paste at least two pages and the set appears here.
The tags appear here as you type. This needs scripting on.
What was checked
What the tags have to do, and where they usually fail
The rule is simple and easy to break. Every page in a set carries the same list of alternates, itself included. If the French page names the English one and the English page does not name the French one back, that pair is broken and Google can drop both annotations. That is why this page gives you one block for the whole set rather than a different block per page: paste the same thing into every one of them.
The codes are a language from the ISO 639-1 list, optionally followed by a country from the ISO 3166-1 list, and never a country on its own. The mistakes are the same ones on every site: en-uk for Britain, where the country is gb and uk means Ukrainian; jp for Japanese, which is ja; and a region for the European Union, which has no code. The check here catches each of those and says what was meant.
x-default is the page for anyone whose language and country match nothing in the list, usually a language selector or the version most visitors should land on. It is optional. Use it when people can arrive from anywhere, and leave it out when every visitor already has a version.
Where the tags live is a choice, and it is one choice for the whole site. The head of the page suits most sites. The HTTP header is for files with no head, PDFs above all. The sitemap is for large sets where editing every template is a project in itself. Two methods that disagree are worse than one, because Google then has to guess which you meant.
Three things this page cannot check, because it has no server to fetch your pages with. Each page must be canonical to itself; a canonical pointing at another version cancels the tags. None of the pages may carry noindex, because a page that is out of the index is out of the set. And the addresses must be live and return the same tags. The tags here are correct as written; those three are yours to confirm on the pages.
Where hreflang tends to go missing
Site moves lose these tags more often than anything else, which is why they have their own line on the migration checklist. The on-page checklist covers the canonical and noindex checks this tool cannot make, and once the versions are in place the SERP preview shows how each country's title and description will be cut.
Questions about hreflang
Do I need hreflang if everything is in English?
Only when different pages serve different countries: an English page for the UK and another for Australia, with their own spelling, currency or contact details. One English page that serves everyone needs no tags at all, and adding them to a single page does nothing.
What goes in x-default?
The page for a visitor whose language and country match none of the others: often a language selector, or the version most people should land on. It is optional. It does not replace the entry for that page under its own code, so the same address can appear twice, once as itself and once as the fallback.
HTML, header or sitemap: which one?
The HTML head for pages whose template you control, which is most sites. The HTTP header for files that have no head, such as PDFs. The sitemap when the set is large and the templates are hard to change. Pick one method for the whole site. Where two methods disagree, Google has to guess which one you meant.
Why does Google ignore my hreflang tags?
Nearly always one of five things: a page missing from another page’s list, a canonical tag that points at a different language version, a noindex on one of the pages, relative addresses instead of absolute ones, or a code that is not on the ISO lists. This tool rules out the first, fourth and fifth. The canonical and the noindex are checks on the pages themselves.
Is anything I type here sent anywhere?
No. Everything happens in your browser. There is no form submission, no analytics event and no network request of any kind, which you can confirm in your browser’s network tab.
Book a call with us
A 30-minute call in your working hours. Tell us what you sell and where, and we will tell you what we would do first and what it involves. Prefer email? Send your website through the form and the Passieon Team will reply within two working days.