close

Free tool

hreflang generator, with the mistakes pointed out

Fill in a language, an optional region and the URL for each version of a page. You get the tags in whichever of the three formats you use, plus a plain list of what is wrong with them. No signup, and nothing you type is sent anywhere: it all runs in your browser.

Where to send a visitor whose language you do not cover. Usually your main page or a language selector.

Output

What is wrong with it

Fill in the rows above and problems will be listed here.

The five things that actually break hreflang

Most broken multilingual setups fail on the same handful of rules. Three of them this page checks for you as you type. Two of them no generator can check, because they are properties of your whole site rather than of the tag, so they are worth knowing before you paste anything.

1. Missing return links

If your English page lists the German page as an alternate, the German page must list the English one back. Search engines treat a one-way declaration as unconfirmed and discard it. This is the most common cause of hreflang being silently ignored, and it is why every page in a set needs the same full block, not a block pointing outward.

2. No self-reference

Each page must include itself in its own list. A German page whose tags mention only English and French is an incomplete set, and incomplete sets get dropped.

3. en-UK instead of en-GB

The language comes from ISO 639-1 and the region from ISO 3166-1. In ISO 3166-1 the United Kingdom is GB, so en-UK is not a real value and is ignored. The tool above flags this one, along with lowercase regions and uppercase languages.

4. Relative URLs, or URLs that redirect

hreflang values must be absolute and include the protocol. They also have to be the final URL. If the target redirects, even from http to https or by adding a trailing slash, the declaration points at the wrong address and is not counted.

5. Pointing at pages a crawler cannot use

A page blocked by robots.txt, marked noindex, or canonicalised to a different URL cannot be an hreflang target. A canonical tag that disagrees with your hreflang set is a particularly quiet failure, because both tags look correct on their own.

Which format to use

Method Use it when Cost
HTML link tags The normal choice for a normal site Every page carries the whole set, so a large site sends a lot of repeated markup
HTTP Link header Non-HTML files, typically PDFs Needs server configuration
XML sitemap Large sites, or when you cannot edit the head of every page One file to maintain, and it is easy to let it drift out of date

Pick one and stay with it. Declaring the same page's alternates in two places is a common source of conflicting signals.

Questions people ask

What is hreflang and do I need it?

It is a tag that tells a search engine which language and region a page is for, so it can show the right version to the right person. You need it once the same content exists at more than one URL in more than one language. If your site is one language, you do not need it at all.

Why do my hreflang tags get ignored?

Almost always the return links. If page A points to page B as its German alternate, page B must point back to A. Google treats one-way declarations as unconfirmed and drops them. That is a property of the whole set of pages, so no generator, including this one, can verify it for you. The other common causes are relative URLs, tags pointing at pages that redirect, and pages that are excluded by robots or a noindex tag.

Is en-UK correct?

No, and it is the single most common hreflang error. The language is from ISO 639-1 and the region is from ISO 3166-1, where the United Kingdom is GB. So it is en-GB. This tool flags it.

Does every page need to reference itself?

Yes. A page must include itself in its own set of alternates. Leaving out the self-reference is the second most common reason a set is ignored.

Should I use x-default?

It is optional but worth setting. It tells the search engine which page to show a visitor whose language you do not cover, and it is usually your main or language-selector page. Without it, that visitor gets whichever version the engine guesses.

Where should the tags go: HTML, headers or sitemap?

Any one of the three, and only one. HTML link tags in the head are the usual choice. HTTP headers are for non-HTML files such as PDFs. The XML sitemap is the tidiest option for large sites because you declare everything in one file rather than editing every page. Do not mix methods for the same page.

Does WeLocale add hreflang automatically?

Yes, on our Pro and Scale plans the widget injects hreflang tags for the languages you have enabled. On the trial and Starter it does not. That is our own product and this tool is free of it: nothing here requires an account.

If you would rather not maintain these by hand

That is what we build. WeLocale translates a site from one script tag and, on the Pro and Scale plans, injects the hreflang tags for the languages you have enabled so the set stays correct as you add languages. On the trial and Starter plans it does not, and this tool is free either way.

What the widget does and does not do · Plans and limits · Translating a WordPress site

Start free trial

Fourteen days, three languages, no card.