Hreflang Tester
Validate hreflang tags for language codes, region codes, x-default, and duplicate values.
Total Tags: 0Errors: 0Warnings: 0x-default: Missing
How hreflang works for international SEO
The hreflang attribute tells search engines which language and region each page is targeting. It helps Google serve the correct language version to users in different countries. The value uses ISO 639-1 language codes (e.g., en), optionally with ISO 3166-1 region codes (e.g., en-US).x-default specifies the fallback page when no locale matches. All alternate pages must include a reciprocal set of hreflang tags.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Checking an existing hreflang set for missing reciprocal references.
- Validating language and region codes against the accepted vocabularies.
- Confirming an x-default entry is present and points somewhere sensible.
- Finding duplicate hreflang values that make the set ambiguous.
- Auditing a multilingual template after a change.
Frequently Asked Questions
- How are the language and region codes validated?
- Against the browser's CLDR registry via Intl.DisplayNames, which returns a name for a known code and echoes the code back for an unknown one. A hand-typed list is the alternative, and in a validator that is a false-error generator: the previous one rejected ga, nb and nn and warned on zh-TW and zh-HK.
- What is zh-Hant, and why is it not a region?
- A script subtag. A BCP 47 tag runs language, then optional script, then optional region — so zh-Hant is Traditional Chinese with no country attached and zh-Hant-TW names both. A four-letter second subtag is always a script, and reading it as a country invents a warning about a region called HANT.
- Can this confirm my whole hreflang setup is correct?
- Only the part one page can show. The error Google reports most is a missing return link — every alternate must point back at every other, itself included — which can only be checked by fetching all of them. What is validated here is the tags in front of it: codes, duplicates, absolute URLs, x-default.
- Why flag two hreflang values sharing one URL?
- Because a URL can be the canonical version of exactly one locale. If en and en-us both point at /en/, there is nothing to distinguish them and the pair is generally ignored. x-default is exempt, since pointing it at the same URL as your default language is ordinary practice rather than a mistake.
- Is x-default required?
- Recommended rather than required, which is why it produces a warning here and not an error once more than one tag is present. It names the page to serve when no listed locale matches — usually a language selector or the international edition — and without it those visitors get whichever alternate is guessed for them.
Common errors and gotchas
- Treating a valid code as a correct one, since `en-UK` parses as a language but the region code is `GB`.
- Missing the self-reference, which invalidates the set for that page.
- Assuming one-way references work, when the relationship must be reciprocal.
- Overlooking that hreflang is a hint rather than a directive.
- Checking the tags without checking that each target actually returns 200.
Related Web & SEO tools
Meta Tag Generator
Build SEO title, description, and viewport meta tags.
Open Graph Generator
Generate Open Graph and Twitter Card meta tags.
Robots.txt Generator
Build a robots.txt file with per-bot rules. Block AI crawlers, set crawl delays, define sitemaps.
UTM Campaign URL Builder
Append UTM parameters to build trackable campaign URLs.
Hreflang Tag Generator
Generate hreflang link tags for multilingual SEO.
Sitemap XML Generator
Build an XML sitemap from a list of URLs.
SERP Snippet Preview
Preview how your page title and meta description appear in Google search.
Meta Tag Analyzer
Paste a page's HTML head to audit its title, meta, and social tags.