NNavShelf

Tools / hreflang Validator

hreflang Validator

Paste the hreflang tags of one or several pages and check the parts that actually break: language codes, x-default, absolute URLs, duplicates and missing return links.

Validation runs in your browser. For the return-link check, separate the pages with a line like “# URL: https://example.com/zh/”.

Why hreflang breaks so easily?

hreflang only works as a complete set: every page names every other language version, codes follow ISO 639-1 and ISO 3166-1, and one entry is x-default. Miss any of those and Google drops the whole cluster, which is how multilingual sites end up cannibalising their own pages.

How to use this tool

  1. Paste the <link rel="alternate" hreflang="…"> tags from a page, or write “lang | url” lines.
  2. Add “# URL: …” before each page when you want the return-link check.
  3. Press Validate to get errors first, then warnings with the counts.
  4. Copy the report, fix the tags, and re-run after the next deploy.

FAQ

Do I need the self-referencing hreflang?

Yes. Every page in the cluster must list itself as well as the alternatives, otherwise the annotations are treated as incomplete and ignored.

Should I use zh-Hans or zh-CN?

Both are valid: zh-Hans is the script form and zh-CN the region form. Pick one style and stay consistent across the cluster — mixing them splits the signals.

Where can hreflang live?

In the HTML head, in the HTTP Link header, or in the sitemap. This validator checks the head form and the plain “lang | url” list; the same code rules apply to the others.