Skip to main content

Search 412 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, guides, blog and product.

XML format

XML sitemap

A list of a site's URLs with optional freshness hints, read by every major search engine. One <urlset> root, one <url> per page, <loc> mandatory.

A sitemap is the simplest useful XML document most teams operate: a <urlset> root containing one <url> per page, each with a mandatory <loc>. Everything else — lastmod, changefreq, priority — is a hint, and search engines weight them very differently.

Because it is generated rather than hand-written, a sitemap fails in generated ways: a routing change silently drops a whole section, a build stamps every lastmod with the deploy time, or pagination pushes the file past a hard limit. None of those are XML errors, so validation alone will not catch them.

Constraints that bite

  • At most 50,000 <url> entries and 50 MB uncompressed per file; split into a sitemap index beyond that.
  • <loc> must be absolute, fully qualified, and entity-escaped — a raw & in a query string makes the file malformed.
  • All URLs in one sitemap must share the host that serves the sitemap, unless cross-submission is configured.
  • lastmod must be W3C Datetime; stamping it with the build time trains crawlers to ignore it.
  • hreflang alternates require the XHTML namespace and an xhtml:link per alternate, on every URL in the set.
Root element
<urlset>
Media type
application/xml
Extensions
.xml, .xml.gz
Namespaces
  • http://www.sitemaps.org/schemas/sitemap/0.9
XMLDir label
sitemap

Specification: sitemaps.org protocol

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

sitemap.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-07-20</lastmod>
    <changefreq>weekly</changefreq>
  </url>
</urlset>

What goes wrong

19 errors in the corpus declare this format — 19 that stop it parsing and 0 that only appear once a schema is applied. The 10 documented elements of this format are listed there too.

The errors that bite XML sitemap documents

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.