Works on this device
Hreflang Generator & Validator
Type the language versions of a page and their URLs to get the hreflang tags for the head of each page, the HTTP header and the sitemap form. Or paste the tags of several pages to find missing return links, wrong codes and duplicates.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your tags will show here
Type the language versions and choose Make the tags.
Result
How it was worked out
How to use the tool
- To make tags, choose Make hreflang tags and type one row for each language version: its code (such as
en-GB,deorx-default) and its full URL. You can also paste a list of rows. - Choose Make the tags. Copy the link tags into the head of every page of the set, or use the HTTP header or the sitemap form instead.
- To check pages, choose Check hreflang tags of pages. For each page, paste its full URL on a line of its own and its head tags under it, or paste a whole XML sitemap.
- To plan URLs, choose Plan the URL of each language version, pick a pattern and the codes, and send the rows to the generator.
The rules of hreflang
- Codes: a language code (ISO 639-1, such as
de), optionally a region (ISO 3166-1 alpha-2, such asde-AT), and optionally a script (such aszh-Hant). Use a hyphen, not an underscore. The United Kingdom isGB, notUK. - x-default names the page for everyone whose language is not in the list, such as a language chooser or the main version. It is optional.
- Full URLs: every link needs the full address with
https://. - Self link: each page lists itself as well as all the other versions.
- Return links: if page A links to page B, page B must link back to page A. Links that are not returned are ignored.
- One URL per code on each page. One URL may serve several codes.
- Three forms: link tags in the HTML head, an HTTP
Linkheader (for PDF and other files), orxhtml:linkentries in an XML sitemap. One form is enough.
Worked example
Rows en https://example.com/en/, de https://example.com/de/, fr-CA https://example.com/fr-ca/ and x-default https://example.com/ give four link tags, such as <link rel="alternate" hreflang="fr-CA" href="https://example.com/fr-ca/">. The sitemap form has one <url> entry for each of the four URLs, each listing all four versions.
In the check example, the English page links to the German page, but the German page does not link back. The check reports the missing return link as a problem of the English page, and the missing x-default as a warning for the German page.
Limits you should know
- Codes are checked by their form (BCP 47: language, optional script, optional region). The kit has no list of ISO 639-1 languages and ISO 3166-1 regions, so a code of the right form that does not exist (such as
xx-QQ) is not found. Check the codes against those lists. - Nothing is fetched. The tool checks only the tags you paste; paste every page of the set to check all return links. A redirect by country or language cannot be tested here.
- URLs are compared exactly as written: http and https, www, capital letters and the final slash all count.
- For other SEO checks of a live page, such as its canonical link and titles, use the On-Page SEO Checker.