Build hreflang tags for a multilingual site, and have them checked before you ship them. hreflang is worth validating specifically because it fails silently: when an annotation is wrong Google ignores it and tells nobody, so the symptom is the wrong language ranking in the wrong country rather than an error in any report. The two mistakes that account for most broken implementations are both caught here — `en-UK`, where the country code is actually GB and the invalid one makes Google discard the annotation entirely, and the missing self-reference, where a page fails to list its own URL and the whole set is ignored rather than partially honoured.
| Mistake | What Google does |
|---|---|
| en-UK instead of en-GB | Ignores the annotation |
| No self-reference | Ignores the whole set |
| One-way links | Ignores the annotation |
| Relative URL | Ignores the annotation |
| Duplicate code | Unpredictable |
| No x-default | Picks for you |
Because the ISO 3166-1 alpha-2 code for the United Kingdom is GB. UK is not a valid alpha-2 code at all, so Google discards the annotation rather than guessing. The markup looks completely plausible, which is why this error survives review for years.
Every page in a set must list its own URL among its hreflang annotations. Without it the entire set is ignored — not partially honoured, ignored — so a correct-looking implementation does precisely nothing. It is the most common reason hreflang appears not to work.
Not strictly, but you want it. It tells Google which page to show a visitor whose language matches none of your versions. Without it, Google picks — usually your most-linked version, which may not be the right one. Point it at a language selector or your most general page.
No. The language comes first and is mandatory; the region is optional. `GB` on its own is invalid, `en-GB` is correct, and plain `en` is fine when you have one English version for everyone.
Yes, and this is the other silent failure. If page A points at page B, B must point back at A. A one-way annotation is ignored. This tool validates a single page's set; check that every page in the group carries the same set.
Link tags in the head for HTML pages — that is what this generates and what almost everyone needs. Headers exist for non-HTML resources like PDFs; the sitemap form works but is harder to keep correct across a large site.
No. The validation runs in the page.
hreflang fails silently, which is what makes a validator worth having: when an annotation is wrong Google ignores it and reports nothing, so the symptom is the wrong language ranking in the wrong country rather than an error anywhere you would look. Every check here corresponds to a failure that behaves that way. The commonest by a distance is `en-UK`. The ISO 3166-1 alpha-2 code for the United Kingdom is GB; UK is not a valid alpha-2 code at all, so the whole annotation is discarded — and because the markup looks plausible, it survives review indefinitely. The same applies to `en-EU`, since hreflang regions must be a single country and there is no code for a union of them. The second commonest is the missing self-reference: every page in a set must list its own URL among its annotations, and without that the entire set is ignored rather than partially honoured, which is why a correct-looking implementation can do nothing whatsoever. A trailing slash is normalised before that comparison, since it is the same page and flagging it would be noise. Beyond those: relative URLs are rejected because hreflang requires the fully qualified address; duplicate codes are rejected because each language and region may point at only one URL; a region-only value such as `GB` is rejected because the language comes first and is mandatory; and casing is raised only as a warning, since lowercase-language and uppercase-region is a convention that still works either way. A missing `x-default` is a warning rather than an error — it is not required, but without it a visitor whose language matches none of your versions gets whichever page Google picks. The generator emits link elements, which is the form that works for HTML pages; the HTTP header and sitemap forms exist for non-HTML resources and are noted rather than generated. Everything happens in the page.