Skip to content
AgileLogics

Sitemap Validator

Fetches an XML sitemap from our server and checks that it's well-formed with a <urlset> or <sitemapindex> root in the sitemaps.org namespace, reporting how many entries it contains.

How it works

Enter a sitemap URL and click Validate.

How do you check that an XML sitemap is valid?

Start with the two things every sitemap consumer needs: the file must parse as XML, and its root element must be <urlset> (a list of pages) or <sitemapindex> (a list of other sitemaps). This validator downloads the sitemap from the URL you give it, checks both, and tells you how many entries it found.

That covers the failures that stop a crawler reading the file at all. Deeper rules from the protocol, like URL limits and escaping, are listed further down so you can check them yourself.

Running the validator

  1. Enter the full sitemap URL, for example https://www.example.com/sitemap.xml. If you don't know it, look for a Sitemap: line in the site's robots.txt.
  2. Click Validate.
  3. Read the one-line result, or the parser error if the XML is broken.

Our server makes the request, following up to ten redirects, with an eight-second timeout per response and a cap of 10 MB on what it reads. URLs that resolve to private or reserved IP addresses are refused.

Results you'll see

A page sitemap with three entries:

Valid sitemap (<urlset>) with 3 URL(s).

A sitemap index pointing at two child sitemaps:

Valid sitemap index (<sitemapindex>) with 2 sitemap(s).

The failures are more informative. These outputs come from real test files:

Message What happened Fix
That is not valid XML: EntityRef: expecting ';' A raw & inside a <loc>, e.g. ?a=1&b=2 Escape it as &amp;
That XML document's root element is <rss>, not <urlset> or <sitemapindex> You entered an RSS or Atom feed URL Use the sitemap URL, or submit the feed to Search Console separately
The sitemap URL returned HTTP 404, not a sitemap. Check the address. The server answered with an error status instead of the file Open the URL in a browser and check what it actually serves
The sitemap URL returned an empty response. A 200 status with no body, often a misconfigured sitemap plugin Regenerate the sitemap and check the server serves it
The <urlset> element declares no namespace; sitemaps must use xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"... The root element is missing its xmlns attribute, or uses an old or misspelled namespace Add the sitemaps.org namespace exactly as shown
That is not valid XML: Start tag expected... The body isn't XML at all, for example a gzip file sent without a Content-Encoding header Serve the uncompressed file, or fix the server's headers
That is not valid XML: Premature end of data in tag loc... The file is truncated, for example by a generator that crashed mid-write Regenerate the file
That sitemap is larger than 10 MB, so this tool didn't check it fully... The file is over this tool's read limit Split the sitemap, or check it locally

The parser's message is passed through as-is, so the exact wording comes from libxml, the XML library PHP uses.

What "valid" means here, and what it doesn't

The check is deliberately narrow. A file passes if the URL answers with a 2xx status, the body is well-formed XML, and its root element is urlset or sitemapindex in the http://www.sitemaps.org/schemas/sitemap/0.9 namespace. The count is the number of <url> or <sitemap> elements in that namespace. It doesn't:

  • confirm each <url> has a <loc>;
  • check that <lastmod> values are real dates;
  • fetch any listed URL, or any child sitemap in an index;
  • read a gzipped file served without a Content-Encoding header.

For a structural check, paste the sitemap and the XSD schema published on sitemaps.org into the XSD validation tool. To read a long sitemap comfortably, run it through the XML formatter.

Protocol rules worth checking by hand

The sitemaps.org protocol and Google's sitemap guide agree on these limits:

  • 50,000 URLs or 50 MB uncompressed per file, whichever comes first. Above that, split into several sitemaps and list them in a sitemap index.
  • UTF-8 encoding, with ampersands, quotes, apostrophes and angle brackets entity-escaped in every value (& becomes &amp;, for example).
  • Absolute URLs. Each <loc> starts with the protocol, and the protocol says it must be under 2,048 characters. Google asks for fully qualified URLs because it fetches them exactly as written.
  • Same host and path. Under the protocol, a sitemap at /catalog/sitemap.xml may only list URLs under /catalog/, on the same protocol and host. Google relaxes the path rule for sitemaps submitted through Search Console.

Google's guide also says it ignores <priority> and <changefreq>, and only uses <lastmod> when it's consistently accurate. If your CMS stamps every URL with today's date on each build, that value is noise; better to drop it or tie it to real content changes. Google calls a sitemap a hint, so a valid file still doesn't guarantee crawling.

After the file validates

A parseable sitemap full of dead or redirected URLs still wastes crawl effort. Spot-check a few <loc> values with the redirect checker: every listed URL should answer 200 directly, not through a redirect. Make sure the sitemap is advertised too: a Sitemap: line in robots.txt is enough for crawlers to find it, and the robots.txt generator can add one.

Last updated

Frequently asked questions

Does this validate my sitemap against the sitemaps.org XML schema?
Not fully. It checks that the file is well-formed XML, that the root element is urlset or sitemapindex, and that the root declares the sitemaps.org namespace, then counts url or sitemap entries. It doesn't check required loc tags, date formats, or whether the listed URLs work.
Can it check a gzipped sitemap (.xml.gz)?
Only if your server sends it with a Content-Encoding gzip header, in which case it's decompressed in transit. A .gz file served as a plain download arrives as compressed bytes and is reported as invalid XML. Point the tool at the uncompressed version instead.
Does it follow the child sitemaps listed in a sitemap index?
No. For an index it reports how many sitemap entries it contains. Paste each child sitemap URL separately to check it.
Why does a big sitemap say it wasn't fully checked?
The tool reads at most 10 MB of a sitemap, because parsing a much larger file would use more memory than a shared web server can spare. Above that it says the sitemap is larger than 10 MB and wasn't fully checked, rather than calling it invalid. The protocol allows up to 50 MB uncompressed, so such a file can still be valid; splitting it behind a sitemap index makes it easier to check.
Is my sitemap URL sent anywhere?
It's sent to our server, which downloads the sitemap and parses it. Your browser can't read another site's files directly because of cross-origin restrictions.