Sitemap Validator Guide: Find and Fix XML Sitemap Errors
Learn how to validate a sitemap URL, interpret XML and protocol errors, and repair URL sets and sitemap indexes before submission.
An XML sitemap is useful only when a crawler can fetch it, parse it, and understand its entries. A successful browser tab is not enough: an error page can return HTTP 200, malformed XML can look plausible, and a sitemap index can point to child files that still need separate checks.
Use the free Sitemap Validator to inspect a public sitemap URL. The report separates fetch failures, XML syntax errors, Sitemap protocol violations, warnings, and tool limits so you can fix the right layer first.
What does a sitemap validator check?
A practical sitemap validation has four stages:
- Fetch the public URL and follow safe redirects.
- Confirm that the response contains XML rather than an HTML error page.
- Parse the document as well-formed, namespace-aware XML.
- Apply Sitemap protocol rules to the root element and each entry.
Sitemap Watch reports the final HTTP status, detected sitemap type, entry and
unique URL counts, file size, validation time, and actionable findings. It
recognizes both urlset documents and sitemapindex documents, including gzip
responses.
Fast sitemap validation checklist
Work from transport to content. Fixing the first failing layer often removes several downstream symptoms.
- The exact sitemap URL is publicly accessible without a login.
- The final response returns a successful HTTP status.
- The response body is XML, not a CMS error or application fallback page.
- The XML has one
urlsetorsitemapindexroot with the Sitemap namespace. - Every
urlorsitemapentry contains one absolute HTTP or HTTPSloc. - Entries belong to the expected host and are not duplicated.
- Optional
lastmod,changefreq, andpriorityvalues use valid formats. - The file remains within the protocol entry and uncompressed size limits.
- Important child sitemaps in an index are validated separately.
A minimal valid URL set
The following sitemap contains two page locations. lastmod is optional, but
when present it should describe the page's meaningful last modification rather
than the time the sitemap was generated.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-08-22</lastmod>
</url>
<url>
<loc>https://example.com/docs</loc>
</url>
</urlset>
A urlset lists page URLs directly. Each url entry requires loc. The
Sitemap protocol also defines lastmod, changefreq, and priority, but those
fields are optional. Google documents that it ignores changefreq and
priority, so do not treat them as ranking controls.
A minimal valid sitemap index
Large sites normally split URLs across child sitemap files and list those files in a sitemap index.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemaps/products.xml.gz</loc>
<lastmod>2026-08-22</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemaps/articles.xml.gz</loc>
</sitemap>
</sitemapindex>
Validating the index confirms the index structure and child locations. It does not prove that every child file is reachable or valid. Open and validate the most important child sitemaps individually, especially after a CMS migration or deployment.
How to read Sitemap Watch results
The validator uses five explicit result states:
- Valid sitemap: the checked document is well-formed and passed the implemented Sitemap protocol checks.
- Valid with warnings: the document can be parsed, but findings such as duplicate locations or a content type mismatch need review.
- Invalid sitemap: the response has XML or protocol errors that need to be corrected.
- Could not fetch sitemap: the URL timed out, failed, or returned an HTTP error before XML validation could run.
- Not fully checked: the response exceeded the free tool's 5 MB processing limit. This is not a claim that the sitemap itself is invalid.
Each finding includes a stable error code, the affected evidence when available, and a suggested fix. Malformed XML findings include line and column information from the parser when possible.
Common XML sitemap errors
The sitemap returns HTML
A URL ending in .xml does not guarantee an XML response. A reverse proxy,
authentication wall, CMS exception, or single-page application fallback can
serve HTML at that path.
Open the exact sitemap URL in a private browser session and inspect the raw response. Fix routing or origin behavior until the direct request returns the XML file. Do this before editing sitemap tags.
Malformed XML
XML must be well-formed. Common causes include an unclosed tag, invalid nesting, truncated output, or an unescaped character such as a bare ampersand in a URL.
<loc>https://example.com/search?q=xml&page=2</loc>
Repair the first reported parser location, regenerate the sitemap, and validate again. One early syntax error can cause several later parser messages.
Missing or invalid loc
Every entry needs an absolute HTTP or HTTPS location. Relative paths and other protocols are not valid sitemap locations.
<loc>https://example.com/products/42</loc>
Generate locations from the site's canonical public origin. Avoid mixing HTTP and HTTPS versions or emitting internal hostnames.
Wrong root or namespace
A page sitemap uses urlset; a sitemap index uses sitemapindex. Both use the
Sitemap protocol namespace.
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
If the namespace is missing, correct the sitemap template rather than adding it with string replacement after generation.
Duplicate URLs
Duplicate locations usually come from multiple database joins, conflicting CMS plugins, or inconsistent canonicalization of query strings and trailing slashes. Deduplicate at the source and keep one entry for each canonical URL.
Mixed hosts
A sitemap should contain locations for a single host. Split different hosts into their own sitemap files. For cross-site submission workflows, verify the ownership and submission requirements of the target search engine instead of assuming that one sitemap can cover unrelated hosts.
Invalid lastmod
Use a W3C date such as 2026-08-22 or a complete datetime with a timezone such
as 2026-08-22T10:30:00Z. More importantly, keep the value truthful. Google
says it can use lastmod when the value is consistently accurate and
verifiable.
Entry or file limits
The Sitemap protocol limit is 50,000 entries and 50 MB uncompressed per sitemap file. Split larger collections into child sitemaps and reference them from a sitemap index. Compression reduces transfer size but does not change the uncompressed protocol limit.
Repair sequence
Use this order when a production sitemap fails:
- Confirm public reachability and the final HTTP status.
- Confirm the raw response is the intended XML document.
- Fix the first XML syntax error and parse again.
- Correct the root, namespace, entry nesting, and required
locfields. - Remove invalid optional values, mixed hosts, and duplicates.
- Split oversized files and validate representative child sitemaps.
- Update the sitemap URL in
robots.txtwhen necessary. - Submit or resubmit the final sitemap in the search engine's webmaster tool.
If you do not know the sitemap URL, start with Find Sitemap. To inspect the locations after validation, use the Sitemap URL Extractor or Sitemap URL Counter. If the site has no sitemap, create a small one with the XML Sitemap Generator.
What validation does not prove
A valid sitemap does not guarantee that search engines will crawl, index, rank, or cite every listed page. The pages still need to be accessible, canonical, indexable, useful, and internally linked. Validation also does not replace a complete XSD validator for image, video, news, or hreflang extensions.
Sitemap Watch intentionally distinguishes a tool limit from a protocol error. The online validator reads up to 5 MB per request even though the Sitemap protocol permits larger files. Use smaller child sitemaps or a local validation workflow when you need to inspect a full large file.
Authoritative references
- Sitemaps XML protocol
- Google Search Central: Build and submit a sitemap
- Google Search Console sitemap report
This guide and the validator rules were last reviewed on August 22, 2026.