sitemap.xml Validator
Check a sitemap.xml for namespace, URL count and per-URL field issues.
Overview
The sitemap.xml Validator parses a sitemap and verifies the namespace declaration, URL count limits, per-URL field validity, and well-formedness against the Sitemaps protocol. It flags malformed dates in <lastmod>, invalid <changefreq> values, out-of-range <priority>, URL count over 50,000, and uncompressed file size over 50 MB.
Useful for SEO practitioners and developers learning how to validate a sitemap.xml file or how to fix sitemap errors. Reach for it before submitting a sitemap to Search Console or when Search Console reports a sitemap could not be read.
How it works
The Sitemaps protocol defines mandatory and optional elements with strict types. <lastmod> must be a valid W3C datetime; <changefreq> must be one of the eight enumerated values; <priority> must be 0.0-1.0. The root element must be <urlset> (or <sitemapindex>) with the correct namespace URI.
The validator parses the XML, reports schema errors with line numbers, lints each <url> entry, and surfaces aggregate stats: total URLs, count with each optional field, distribution of <priority> values, and URLs grouped by host (catching the common error of mixing www and bare hosts in one sitemap).
Examples
- A sitemap with 49,800 URLs passes; one URL has an invalid
<lastmod>of2024-13-01reported with its line number. - A sitemap missing the namespace declaration is flagged as not-recognised by Google.
- 52,000 URLs in a single file produce a hard error and recommendation to split into a sitemap index.
- Mixed
https://example.com/andhttps://www.example.com/URLs are warned because they likely don't all belong to the same canonical site.
FAQ
My sitemap looks fine but Search Console says "couldn't fetch" — why?
That's a fetch error, not a validation error. Check that the URL returns 200, the content type is XML, the file is publicly accessible, and there's no robots.txt rule blocking the path.
Can sitemap.xml be compressed?
Yes — gzip-compressed sitemaps (.xml.gz) are accepted by Google. The 50 MB limit applies to the uncompressed size.
Are duplicate URLs flagged?
Yes — duplicates within a single sitemap are reported. Each canonical URL should appear exactly once.
Should the order of URLs matter?
No, search engines do not infer importance from order. List in any order — alphabetical is common for human readability.