Hreflang Tag Generator and Validator
Build hreflang tags for every language version of a page, export them as HTML, Link headers or sitemap entries, and check existing tags for missing return links and wrong codes.
S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho
…
Com es fa
- 1Create a set
Name the page set and add one row per language version.
- 2Fill from a pattern
Or type a URL pattern with [code] and a list of codes to generate the rows.
- 3Add x-default
Enter the fallback URL for unmatched languages.
- 4Read the checks
Fix any code or URL flagged under the set.
- 5Export
Choose HTML, HTTP header or sitemap output and copy or download it.
- 6Validate live pages
Paste page sources on the Validate tab and fix missing return links.
Sobre aquesta eina
Hreflang annotations tell search engines that several URLs are versions of the same page for different languages or regions, so a reader in Vienna gets the German page and a reader in Toronto gets the Canadian French one. They are easy to get wrong: every version must list every other version and itself, codes must follow ISO 639-1 for language and ISO 3166-1 for region, and the links must be absolute. One broken return link is enough for Google to ignore the pair. This generator keeps each page and its language versions as a set. Type a code and URL per row, or fill a whole set from a URL pattern such as https://example.com/[code]/pricing and a list of codes. Every code is checked as you type and labelled in plain words, for example English (United Kingdom) or Spanish (Latin America), so mistakes like en-uk, jp or es_ES are caught before they ship.
Three output formats
HTML link elements go in the head of every page in the set. The HTTP Link header is meant for PDFs and other files without a head. The XML sitemap format repeats the full set under each URL with xhtml:link elements, which suits large sites where templates are hard to change. Pick one method per URL; mixing them is allowed but harder to maintain.
Validating existing pages
Paste the source of several pages, each after a line with three equals signs and its URL, or paste a sitemap that already carries xhtml:link elements. The validator checks codes, duplicate codes pointing to different URLs, relative or empty hrefs, tags placed in the body, a missing self-reference, sets that differ between versions and missing return links between the pages you pasted. The result can be opened in the builder for editing.
Code checks without tables
Codes are checked against the language and region names your browser knows through its built-in internationalisation data, plus a short list of frequent mistakes. Scripts such as zh-Hant are understood, and region 419 for Latin America is accepted.
Limits
The tool cannot fetch your pages because browsers block reading other sites, so it checks only what you paste. Return links to pages you did not paste are listed as unchecked. It does not decide which version Google shows; hreflang is a hint, and canonical tags or blocked pages can override it.
Exemple resolt
A software company has a pricing page in en, en-gb, de, fr-ca and es-419, with the English page as x-default. The builder outputs six link elements per page. The validator, given the English and German sources, reports that the English page uses en-uk instead of en-gb, that the German page's set is incomplete because it leaves out the en-gb URL, and that the German x-default is the relative path /en/pricing. After fixing the three issues, the check shows 0 errors for both pages.
En resum
- Categoria: Desenvolupament i dades
- S'executa al navegador, sense registre, sense pujar res.
- La informació que introdueixes es queda al dispositiu.
- Disponible en anglès.
- Contingut revisat per última vegada:
- Font oficial: Google Search Central: localized versions of your pages (hreflang)
Preguntes freqüents
Do I need x-default?
It is recommended. It names the page for users whose language matches none of your versions, often the main language or a language picker.
Is en-uk valid?
No. The ISO region code for the United Kingdom is GB, so use en-gb. The tool flags en-uk and suggests the fix.
Can a language code stand alone?
Yes, and it is often wise to add one. A plain de version catches German speakers in every region that has no specific version.
Should the canonical point to one language?
No. Each language version should carry a self-referencing canonical. A canonical to another language tells Google to ignore the hreflang set.
How many languages can a set have?
There is no fixed limit, but every page repeats the whole set, so very large sets are easier to manage in the sitemap.
Is anything sent to a server?
No. Building and validating run in your browser, and the sets are saved locally on this device.
