Hreflang validator

Paste hreflang tags, a Link header or a sitemap. Everything is validated in your browser against Google's documented rules, without fetching a thing.

Load a sample:

Needed to check that the page lists itself.

Detected: HTML · 4 annotations

4 errors

  • Error · hreflang="en-UK""UK" is reserved, not an assigned ISO 3166-1 code, so Google ignores it. Use "en-GB".
  • Error · hreflang="de_DE"Use a hyphen, not an underscore: write "de-DE". hreflang values are language-region pairs separated by a dash.
  • Error · hreflang="es-419""419" is a UN M.49 numeric area code. Google supports only ISO 3166-1 alpha-2 region codes, so values such as es-419 are not supported. Use plain "es" or specific countries (e.g. es-MX).
  • Error · /es/Alternate URLs must be fully qualified, including http:// or https:// (not //example.com/foo or /foo).
  • NoteNo x-default. Optional, but it tells Google which URL to show searchers whose language matches none of your versions.
hreflangURL
enhttps://example.com/
en-UKhttps://example.com/uk/
de_DEhttps://example.com/de/
es-419/es/

Rules the validator applies

Every check maps to a line in Google's documentation:

  • Language first, ISO 639-1. de, pt, zh. Three-letter codes and country codes on their own (jp, uk) are rejected; see the language code table.
  • Region second, ISO 3166-1 alpha-2. en-GB, not en-UK. Reserved codes like EU and UN have no effect, and UN M.49 areas such as es-419 aren't supported. See the country code table.
  • Optional script, ISO 15924, for languages written in more than one script: zh-Hant, zh-Hans-SG.
  • Hyphen, not underscore. de_DE is a locale string from software, not an hreflang value.
  • Fully qualified URLs with the protocol.
  • Self-reference and return links. Each version lists itself and every other version, and every link is confirmed from the other side.
  • rel="alternate" on each link, and the xmlns:xhtml namespace in sitemaps.

Case doesn't matter to Google, so en-gb passes with only a note about conventional casing.

Hreflang validator questions

What can I paste into the hreflang validator?

Three things: HTML (a full page source or just the link elements from the head), an HTTP Link header, or an XML sitemap with xhtml:link alternates. The format is detected automatically.

Does the validator fetch anything?

No. Everything runs in your browser, so it works for staging builds, local files and pages behind a login. To test a live page and its alternates, use the hreflang checker.

Why add the page URL?

With the URL of the page the tags came from, the validator can confirm that the set includes the page itself, which Google requires.

How does it check return links in a sitemap?

Every <url> entry is treated as a page. If entry A lists entry B as an alternate, B must list A too. Missing pairs are reported as missing return links.