---
url: https://findutils.com/guides/sitemap-validator
title: "Validate an XML Sitemap: Find the Errors Search Engines Trip On"
description: "Check sitemap.xml against the sitemaps.org protocol: well-formed XML, absolute URLs, escaped ampersands, lastmod dates and the 50,000-URL limit."
category: seo
content_type: guide
guide_type: subtopic
cluster: developer
locale: en
read_time: 7
status: published
author: "olgunozoktas"
published_at: 2026-09-26T12:00:00Z
excerpt: "A sitemap can look fine in a browser and still carry an unescaped ampersand, a relative URL or a date in the wrong format. Validating it against the protocol, with a line number for every problem, finds those before a search engine reports the file as unreadable."
tag_ids: ["sitemap", "seo", "xml", "crawling"]
tags: ["Sitemap", "SEO", "XML", "Crawling"]
primary_keyword: "xml sitemap validator"
secondary_keywords: ["validate sitemap.xml", "sitemap checker", "sitemap lastmod format", "sitemap unescaped ampersand", "sitemap index validator"]
tool_tag: "sitemap-validator"
related_tool: "sitemap-validator"
related_tools: ["sitemap-validator", "xml-sitemap-generator", "robots-txt-tester", "robots-txt-generator"]
og_image: "/images/content/guides/sitemap-validator-cover-20260926.webp"
image_alt: "A tree of frosted glass nodes glowing blue, with two nodes amber and one red as if flagged."
updated_at: "2026-09-26T12:00:00Z"
---

To validate an XML sitemap, check that it is well-formed XML, that its root is `<urlset>` or `<sitemapindex>` in the sitemaps.org namespace, and that every entry has an absolute `<loc>` plus valid `<lastmod>`, `<changefreq>` and `<priority>` values within the protocol's limits. FindUtils [XML Sitemap Validator](/seo/sitemap-validator/) runs all of those checks in your browser and reports every issue with a severity, a rule name and its line number. It checks the text you paste and fetches nothing.

This guide covers the rules the protocol sets, what the validator checks, a worked example, and what a valid sitemap still does not guarantee.

## Why Validate a Sitemap?

A sitemap is read by software, and small mistakes make parts of it unreadable:

- **An unescaped `&`** in a URL with query parameters breaks the XML.
- **A relative URL** such as `/about` is not allowed; the protocol and Google both ask for absolute URLs.
- **A date in the wrong format**, such as `01/09/2026`, is not a valid `<lastmod>`.
- **A generator bug** can produce duplicate URLs, URLs from another host, or more than 50,000 entries in one file.

A browser shows most of these files without complaint, which is why they ship.

## The Protocol's Rules and Limits

These come from the [sitemaps.org protocol](https://www.sitemaps.org/protocol.html):

| Rule | Limit or format |
|---|---|
| URLs per sitemap | At most 50,000 |
| File size | At most 50 MB uncompressed |
| Sitemap index | The same limits; up to 50,000 sitemaps |
| `<loc>` | Absolute URL, less than 2,048 characters |
| Encoding | UTF-8, with `&`, `<`, `>`, `"` and `'` escaped as entities |
| `<lastmod>` | W3C Datetime; the time may be left out (`YYYY-MM-DD`) |
| `<changefreq>` | `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly` or `never` |
| `<priority>` | 0.0 to 1.0; the default is 0.5 |
| Hosts | All URLs in one file from a single host |

## What Does Google Actually Use?

Google's [sitemap documentation](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap) states that "Google ignores `<priority>` and `<changefreq>` values" and that it uses `<lastmod>` "if it's consistently and verifiably" accurate. So a wrong `<priority>` is still a protocol error worth fixing, but tuning priorities will not change how Google crawls. An accurate `<lastmod>` is the optional field worth maintaining.

## How to Validate a Sitemap

### Step 1: Paste the XML

Open [XML Sitemap Validator](/seo/sitemap-validator/) and paste the sitemap or sitemap index. Use the uncompressed XML: a `.xml.gz` file must be unzipped first.

### Step 2: Read the summary

The summary shows the type (`urlset` or `sitemapindex`), the number of entries, the hosts found, and the count of errors and warnings. The sitemap is valid when there are no errors.

### Step 3: Fix issues by line

Each issue names its rule, its line and, where there is one, the URL. Errors break the protocol; warnings are worth a look but do not make the file invalid.

### Step 4: Validate again

Fix the source, not just the file: if a generator wrote the mistake, it will write it again next time.

## A Worked Example

```xml
<?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-09-01</lastmod></url>
<url><loc>https://example.com/search?q=a&b=2</loc></url>
<url><loc>https://example.com/about</loc><lastmod>01/09/2026</lastmod><priority>1.5</priority></url>
<url><loc>https://example.com/</loc></url>
</urlset>
```

The validator reports 4 URLs, 3 errors and 1 warning, and marks the file invalid:

| Line | Severity | Rule | Message |
|---|---|---|---|
| 4 | Error | `loc-unescaped-ampersand` | Unescaped "&" in `<loc>`; write it as `&amp;` |
| 5 | Error | `lastmod-format` | `"01/09/2026"` is not a W3C datetime |
| 5 | Error | `priority-range` | `"1.5"` must be a number from 0.0 to 1.0 |
| 6 | Warning | `duplicate-loc` | Duplicate `<loc>`; first listed on line 3 |

The fixes: write `https://example.com/search?q=a&amp;b=2`, write the date as `2026-09-01`, set the priority to `1.0` or remove it, and delete the repeated homepage entry.

## Everything the Validator Checks

| Check | Severity |
|---|---|
| XML is not well-formed (stops at the first problem, with its line) | Error |
| Root is neither `<urlset>` nor `<sitemapindex>` | Error |
| Namespace missing or not `http://www.sitemaps.org/schemas/sitemap/0.9` | Warning |
| An entry with no `<loc>`, or an empty `<loc>` | Error |
| `<loc>` not an absolute http(s) URL, containing whitespace, holding a bare `&`, or longer than 2,048 characters | Error |
| Duplicate `<loc>` | Warning |
| URLs on more than one host | Warning, once |
| `<lastmod>` not a W3C datetime | Error |
| `<lastmod>` more than a day in the future | Warning |
| `<changefreq>` not one of the seven values | Error |
| `<priority>` outside 0.0 to 1.0 | Error |
| More than 50,000 entries | Error |
| An element other than `<url>` or `<sitemap>` directly inside the root | Warning |

Valid `<lastmod>` forms are `2026`, `2026-09`, `2026-09-01`, and a date with a time and a timezone, such as `2026-09-01T10:00:00+02:00` or `2026-09-01T10:00Z`. A time with no timezone, like `2026-09-01T10:00:00`, is an error. Impossible dates such as `2026-02-29` are errors too.

Image, video, news and `xhtml:link` extensions in their own namespaces are skipped, not flagged.

## Limits of the Check

- **It reads up to 10 MB of XML.** The protocol allows 50 MB; validate a larger file in parts.
- **It does not fetch the URLs.** A `<loc>` is checked for shape, not for a 200 response, a redirect or a `noindex`.
- **It does not follow a sitemap index.** Each child sitemap has to be validated on its own.
- **It does not check robots.txt.** A URL listed in the sitemap but blocked in robots.txt is a contradiction; test those paths with [robots.txt Tester](/seo/robots-txt-tester/).
- **Valid is not indexed.** A clean sitemap helps discovery; it does not make a search engine index a page.

## Common Mistakes

**Escaping in the CMS, not in the XML.** A URL with `&` must be written `&amp;` inside the file, even though the real URL has a plain `&`.

**Listing URLs that redirect or are blocked.** List the final, canonical URL that returns 200 and is allowed to be crawled.

**Setting every lastmod to today.** Google uses `<lastmod>` only when it is consistently and verifiably accurate; a date that changes on every build while the page stays the same is not accurate.

**Mixing hosts.** `www.example.com` and `example.com` are different hosts. Pick one.

## Use It From Code

The validator is the `sitemap_validator` tool on the FindUtils REST API and MCP server. Text sent there is processed on the server rather than in your browser.

```bash
curl -X POST https://api.findutils.com/api/tools/sitemap-validator/execute \
  -H "Content-Type: application/json" \
  -d '{"xml":"<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"><url><loc>/about</loc></url></urlset>"}'
```

That returns `valid: false` with one `loc-not-absolute` error on line 1. The response also carries `type`, `url_count`, `hosts`, `issues` (up to 1,000) and the first 1,000 `urls`. See the [API reference](/api/sitemap-validator/) and the [MCP reference](/mcp/sitemap-validator/).

## Tools Used in This Guide

| Tool | Use |
|---|---|
| [XML Sitemap Validator](/seo/sitemap-validator/) | Check a sitemap or sitemap index against the protocol |
| [XML Sitemap Generator](/seo/xml-sitemap-generator/) | Build a sitemap from a list of URLs |
| [robots.txt Tester](/seo/robots-txt-tester/) | Check that sitemap URLs are not blocked |
| [Robots.txt Generator](/seo/robots-txt-generator/) | Add the Sitemap line to a new robots.txt |

## FAQ

### How many URLs can a sitemap have?

At most 50,000 URLs and 50 MB uncompressed per file. For more, split the URLs into several sitemaps and list them in a sitemap index.

### What date format does lastmod use?

W3C Datetime: `YYYY-MM-DD`, or a full date and time with a timezone, such as `2026-09-01T10:00:00+02:00`.

### Does Google use changefreq and priority?

No. Google's documentation states that it ignores both. It uses `<lastmod>` when the dates are consistently accurate.

### Does the validator check that my URLs work?

No. It checks the XML and the shape of each URL but fetches nothing, so a URL that returns 404 is not detected.

### Can it validate a gzipped sitemap?

Not directly. Unzip the `.xml.gz` file and paste the XML.

## Next Steps

Check your file with [XML Sitemap Validator](/seo/sitemap-validator/). To build one from scratch, use the [XML Sitemap Generator](/seo/xml-sitemap-generator/) and read its [guide](/guides/xml-sitemap-generator-guide/).
