XML sitemap
<urlset>
The root element of every sitemap. Its namespace declaration is what makes the document a sitemap rather than a list of URLs.
There is exactly one <urlset> per file and it contains nothing but <url> elements. The namespace on it is not decoration: a crawler identifies the document by that URI, and a sitemap that declares the wrong one — or none — is a well-formed XML file that no search engine will read as a sitemap.
The protocol's two hard limits live here as well. A single sitemap may carry at most 50,000 URLs and may be at most 50 MB uncompressed; past either, you need a sitemap index pointing at several files.
- Format
- XML sitemap
- Namespace
- Sitemap protocol 0.9
- Parent
- None — this is the document element
- How many
- Exactly one, as the document element.
Cardinality and constraints
Exactly one, as the document element.
- Must declare xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" — the version is part of the URI and 0.9 is current.
- At most 50,000 <url> children and 50 MB uncompressed. Beyond that, split and use a sitemap index.
- Only <url> children are allowed; extension elements go inside a <url>, not beside it.
What our validator does
The sitemap validator counts the <url> children and reports an error when there are none, along with the file size against the 50 MB limit.
Broken and fixed
Both documents below are well-formed XML — that is the point of this corpus — and both are run through the validator on every test run. The verdicts here are what it returned, not what we expect it to.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
</urlset>Sitemap contains no URLs.<?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-10</lastmod>
</url>
</urlset>Where it reaches
- FormatsXML sitemapThe format page: root element, namespaces and the constraints that bite.
- NamespacesSitemap protocol 0.9The URI this element must declare, and the one most often mistyped.
- ToolsSitemap validatorRuns the checks quoted here against your own file.
Related elements
- <url>One entry in a sitemap: a required <loc> plus the optional metadata a crawler may or may not use.
- <loc>The URL itself — the only required child of <url>, and the element where ampersands in query strings go wrong.
- <sitemapindex>The root element of a sitemap index: a list of sitemaps rather than a list of URLs, in the same namespace as an ordinary sitemap.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.