Two files can both be named sitemap.xml and both open happily in a browser, while only one of them actually follows the sitemap protocol. The other might be missing its namespace declaration, carry dates in a regional format, or be XML that only looks structured until a strict parser reads it. Search engines parse these files mechanically, so the difference between "looks right" and "is right" is the whole game.
This guide shows how to check the protocol side of a sitemap (its root element, namespace, URLs, dates and limits) and the encoding side (whether the file is well-formed XML that parses cleanly), using the free Sitemap Validator on Ovatly.
Contents
- Quick answer
- What "the right protocol" actually requires
- The encoding side: well-formed XML that parses
- How to check a sitemap, step by step
- Worked example: checking a sitemap index file
- Limitations
- Common mistakes
- FAQs
- Conclusion
Quick answer
A sitemap uses the right protocol when it has: well-formed XML, the sitemap namespace declared on the root element, an absolute URL in every entry's loc element, W3C-format dates wherever lastmod is used, and no more than 50,000 URLs or 50 MB uncompressed in a single file. The encoding side is simpler to state: the file must parse as XML without breaking. Paste the file into the Sitemap Validator and read the summary: it reports the file type, entry count, size and error count, which together tell you whether both sides hold.
What "the right protocol" actually requires
The protocol starts at the root element, because the root declares what kind of file this is. A list of pages sits inside a urlset root. A sitemap index, a file that points at other sitemap files, is detected by its sitemapindex root, and each child sitemap entry's loc and lastmod are checked the same way as entries in a urlset. If the root is wrong, nothing below it can be read as intended.
Next comes the namespace. The urlset element should declare xmlns="http://www.sitemaps.org/schemas/sitemap/0.9". Without it, strict parsers and some search engines will not recognise the file as a sitemap at all. This is a one-line declaration, and its absence is invisible when you skim the file, which is why it survives code reviews.
Inside the entries, three rules do most of the work. Every loc holds an absolute URL, complete with its protocol. Every lastmod date uses the W3C format, year first, such as 2026-01-31. And the whole file stays inside the documented limits: 50,000 URLs per file and 50 MB uncompressed. A priority value, where present, stays between 0.0 and 1.0; outside that range it earns a warning rather than an error.
The encoding side: well-formed XML that parses
A sitemap is an XML document, and before any protocol rule can be checked, the file has to parse as XML. Malformed XML is an error in its own right: the moment the structure breaks, a parser cannot reliably read the entries at all. This is where encoding problems show themselves in practice. A file copied through tools that mangle its characters, or assembled by hand with broken tags, stops being well-formed, and the parse fails before the protocol checks begin.
The validator parses the XML with the browser's DOMParser and checks both urlset and sitemapindex files, including the namespaced variants produced by common CMS plugins. That last point matters: a file is not wrong merely because a plugin produced it with its own namespaced flavour. The check is whether the document parses and whether its structure matches the protocol, not which tool wrote it. Everything runs in your browser, so the XML you paste is parsed on your device and never uploaded.
How to check a sitemap, step by step
- Paste the full sitemap.xml content into the box in the Sitemap Validator.
- Read the summary: file type, entry count, size and error count. The file type alone confirms whether the root element was read as a urlset or a sitemap index.
- Fix the errors first, then review the warnings.
- Re-paste the corrected file to confirm it is clean.
- If the file is a sitemap index, run each child sitemap it lists through the same check.
Worked example: checking a sitemap index file
Suppose a site's sitemap.xml turns out to be an index: its root is a sitemapindex element listing four child sitemaps. Pasting it in, the summary reports the file type as a sitemap index, with its entry count, size and error count. The index itself can pass cleanly, because each child entry's loc and lastmod are checked the same way as urlset entries.
That pass is not the end of the job. The index only points at the children; it says nothing about whether the children parse or follow the protocol. Step 5 exists for this case: fetch each child sitemap, paste it in turn, and read its own summary. A child with a day-month-year lastmod or a missing namespace fails on its own, even under a valid index. Four children means five checks in total, and the index passing first is the expected result, not a shortcut.
Limitations
The validator checks the text you paste, not the file live on your server. After fixing errors, upload the corrected file and paste its contents once more to confirm the published copy is clean. It also validates the file you give it as it stands: it will not fetch the child sitemaps of an index for you, so that step stays manual.
A clean validation means the file is well-formed and consistent; it cannot tell you whether the listed pages themselves are indexable or worth crawling. Protocol and encoding are the file's half of the problem. The mistakes that most often break the entry-level rules, wrong dates, duplicates and incomplete URLs, are covered in the companion guide on common sitemap validation mistakes.
Common mistakes
- Skimming the file instead of parsing it. A missing namespace or a broken tag is invisible to the eye and obvious to a parser.
- Checking only the index. An index can pass while a child sitemap fails; every child needs its own pass through the check.
- Assuming a plugin's file is automatically valid. Namespaced CMS variants are accepted, but the plugin's dates and limits still have to follow the protocol.
- Pasting a local draft for the final check. The published copy is the one engines fetch; paste that.
- Treating size as a detail. A file past 50,000 URLs or 50 MB uncompressed breaches the protocol no matter how clean its entries are.
FAQs
Why does my file need the sitemap namespace?
The urlset element should declare xmlns="http://www.sitemaps.org/schemas/sitemap/0.9". Without it, strict parsers and some search engines will not recognise the file as a sitemap.
Can this validate a sitemap index file?
Yes. Index files are detected by their <sitemapindex> root, and each child <sitemap> entry's loc and lastmod are checked the same way.
What does a valid sitemap need?
Well-formed XML, the sitemap namespace declared on the root element, an absolute URL in every entry's loc element, W3C-format dates wherever lastmod is used, and no more than 50,000 URLs or 50 MB uncompressed in a single file.
How often should I check my sitemap? Whenever the file changes: after generating a new one, after a redesign or migration, and after adding or removing a large number of pages. A quick check then is cheaper than finding crawl problems weeks later.
Does the validator fetch the sitemap from my server? No. The validator checks the text you paste, not the file live on your server. After fixing errors, upload the corrected file and paste its contents once more to confirm the published copy is clean.
Conclusion
Protocol first, then parse: the right root and namespace, absolute URLs, year-first dates, the documented size limits, all carried in XML that parses cleanly. The Sitemap Validator checks both sides in one paste, and the summary's file type line alone settles arguments about what a file actually is. Check whenever the file changes, and check the published copy. More guides like this one live in the SEO Tools guides archive.