Indexer

Sitemap XML Explained: Format, Limits and Lastmod

Flat illustration of an XML sitemap document feeding a search engine crawler, on a dark background

A sitemap is the oldest submission channel on this blog's three channels, older than the Indexing API and older than IndexNow, and it is still the one every site should have. It is a single file that lists the URLs you want search engines to know about, in a format every major engine reads. This guide walks the whole format with the same worked example domain as the rest of this blog, example.com: every tag from urlset to lastmod, the two hard limits, what happens past them, the location rule most sites never hear about, and the honest answer on changefreq and priority, which Google ignores. There is also a paste in checker that reads your own sitemap.xml and reports what an engine would complain about.

Key takeaways#

  • A sitemap is a hint, not a command. Engines read it, schedule crawls at their own pace, and still index pages through links whether or not they are listed.
  • The format is small: a urlset root, one url element per page, a required loc, and optional lastmod, changefreq and priority.
  • Each sitemap file holds at most 50,000 URLs and at most 50MB, counting the uncompressed size even when you serve it gzipped.
  • Past the limits you split into multiple files and group them with a sitemap index, which itself holds up to 50,000 child sitemaps.
  • Google ignores changefreq and priority entirely, and uses lastmod only when it is verifiably the real modification date of the page.
  • A sitemap only lists URLs under its own path on its own host, and engines drop the URLs that break that rule.

What a sitemap actually is#

A sitemap is a URL list with metadata. You publish one file, engines fetch it on their schedule, and every URL in it becomes a candidate for crawling. That is the entire contract. The protocol page at sitemaps.org, which Bing, Google and Yandex all implemented, defines the XML shape, and everything else in this guide comes from either that page or Google's own documentation.

What the file buys you is discovery, not indexing. A page listed in a clean sitemap gets found faster than a page five clicks from the homepage, especially new pages on sites without strong link profiles. What it does not buy you is a promise: engines reserve the right to skip any URL, and the verdicts that matter, indexed or not, come from the engines' own analysis of the page. The same honest framing runs through this blog's other guides, because the same rule holds for the Indexing API and for IndexNow.

The format, tag by tag#

The smallest valid sitemap for the 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>
  </url>
</urlset>

Four things in that snippet are required, and all four are checked by validators. The file must begin with the XML declaration and be UTF-8 encoded. The root element is urlset, carrying the namespace of protocol version 0.9. Each page is one url element. And inside each url, loc carries the absolute URL of the page.

The loc rules are precise. The value must begin with the scheme, https or http, including the port if the site serves on one. It must be under 2,048 characters. It should end with a trailing slash if your web server requires one, so https://example.com/ is correct for the homepage and https://example.com is not, when the server redirects. Every value in the file must be entity escaped, covered in its own section below, because query strings with ampersands break unescaped XML.

Three optional children can follow loc inside a url: lastmod, changefreq and priority. Two of them are dead weight, which is the next two sections.

lastmod, the one field engines read#

lastmod carries the date the page was last modified, in W3C datetime format. The full form is 2026-10-04T09:30:00+00:00, and the format allows dropping the time entirely, so plain 2026-10-04 is valid. For a blog that publishes with timestamps, the full form is the natural choice, and for most other sites the date alone is enough.

The protocol page is specific about what the value must mean: the date the linked page was last modified, not the date the sitemap was generated. That single sentence is the difference between a useful lastmod and a useless one. Sitemap generators that stamp every entry with the build date are the most common failure in the wild, because a file where every URL says "modified today, and yesterday said the same" teaches the engine to distrust the field.

Google's position, stated in its own sitemap documentation, is that it uses lastmod only when the value is consistently and verifiably accurate, for example by comparing it against the last modification the crawler observes on the page itself. When the field is trustworthy, it helps the engine prioritize which listed URLs to crawl first. When it is not, it is ignored, and no ranking is lost by that ignoring: lastmod affects crawl scheduling, never position.

One subtlety the protocol notes explicitly: lastmod is separate from the If-Modified-Since mechanism, where the web server answers a conditional request with 304 Not Modified. Engines may use both sources, and they are not required to agree. Serving accurate 304 responses and writing honest lastmod values are two independent good habits.

changefreq and priority, the two fields Google ignores#

The protocol defines changefreq with seven valid values: always, hourly, daily, weekly, monthly, yearly and never. It also defines priority as a number from 0.0 to 1.0, where 0.5 is the default, meant to signal which URLs on your site matter most relative to each other.

Google's documentation says it plainly: Google ignores priority and changefreq values. The protocol page itself hedges in the same direction, calling changefreq a hint and not a command, noting that crawlers may fetch hourly pages less often than hourly and never pages occasionally anyway, and warning that a high priority on every URL is unlikely to help anything.

The practical conclusion for a new sitemap: lastmod on, changefreq and priority off. The file gets smaller, every byte of it stays true, and nothing that an engine reads is lost. Sites with legacy sitemaps that carry the two fields lose nothing by keeping them, but no tooling should add them back.

The two hard limits#

Every sitemap file is bounded by two limits, whichever is hit first: 50,000 URLs, and 50,000,000 bytes uncompressed. The byte limit is exactly 52,428,800 bytes in the protocol's own arithmetic. Compression is explicitly allowed, gzip being the standard choice, and it genuinely saves transfer bytes, but the limit applies to the uncompressed file, so gzipping does not rescue an oversized sitemap.

Most sites hit the URL limit long before the byte limit, because a typical url element with a lastmod runs 100 to 150 bytes, putting 50,000 entries around 5 to 8MB. The byte limit becomes the binding constraint for sites with very long URLs, query string heavy catalogs, or multilingual hreflang extensions, where each URL entry expands into several alternates.

Past either limit, the file must be split. A single site can serve any number of sitemap files, and the standard way to organize them is the subject of the next section.

Scaling with sitemap index files#

Once you split, you group. A sitemap index is a small XML file that lists your sitemap files:

One sitemap file at its limit, split into three child files grouped under an index
XML
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap-posts.xml</loc>
    <lastmod>2026-10-04</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-pages.xml</loc>
    <lastmod>2026-09-16</lastmod>
  </sitemap>
</sitemapindex>

The shape mirrors a regular sitemap: sitemapindex replaces urlset, sitemap replaces url, and loc is required inside each. The optional lastmod on an index entry means something different from a page's lastmod: it identifies when the child sitemap file itself was modified, and Google's documentation says it uses it to schedule when to re-fetch that child file.

The limits stack one level up. A sitemap index may list up to 50,000 sitemaps and must itself stay under 50MB. With 50,000 child files of 50,000 URLs each, the theoretical ceiling is 2.5 billion URLs, and Google adds its own cap of up to 500 submitted sitemap index files per site, which still leaves room for 25 billion URLs and is far past any real catalog.

The constraint to respect is the same site rule from the next section: a sitemap index can only reference sitemap files on the same site as the index itself.

The location rule#

Where the sitemap lives constrains what it may list. A sitemap at https://example.com/catalog/sitemap.xml can list any URL under https://example.com/catalog/, and nothing else: not https://example.com/images/, not https://subdomain.example.com/, and not http:// URLs when the sitemap itself is served over https. The protocol drops URLs that break the rule from further consideration, silently.

This is why the protocol strongly recommends the root directory: https://example.com/sitemap.xml can list every URL on the host. The subdirectory placement only makes sense when different teams own different paths on one host.

Two consequences of the rule are worth naming. Different subdomains are different sites, so www.example.com and shop.example.com need separate sitemaps, each on its own host. And a port number, when present, is part of the identity: a sitemap served on port 100 lists URLs on port 100.

For genuinely multi host setups, the protocol defines cross submits, where sitemaps for several hosts live on one host and each target host's robots.txt points at them, proving control. It works, it is documented, and for most sites it is more mechanism than the simpler one sitemap per host answer.

Escaping and encoding#

The file must be UTF-8 encoded, and every value in it must be entity escaped, the standard XML five:

CharacterEscape
&&amp;
<&lt;
>&gt;
"&quot;
'&apos;

The ampersand is the one that bites, because URLs carry query strings. The catalog URL https://example.com/catalog/show?item=23&user=3453 is correct in a browser and broken in raw XML: the unescaped ampersand makes the file invalid, and a strict parser rejects the whole sitemap. The same URL in the sitemap must read https://example.com/catalog/show?item=23&amp;user=3453. Generators do this automatically, and hand edits are where it breaks.

A file that fails XML parsing fails entirely. There is no partial credit for the entries that happened to be well formed, which is why the checker below reports a parse failure as its first class of problem.

Telling the engines#

Three channels exist, and all three can be used at once.

The robots.txt line is the baseline and works for every engine: Sitemap: https://example.com/sitemap.xml anywhere in the file, independent of any User-agent rules, and multiple lines are allowed with no limit on the count. Engines that never heard from you still find the file on their next robots.txt fetch.

Search Console is the channel with feedback: submit in the Sitemaps report and you see when Google last read the file and any processing errors it found. The same submission is available programmatically through the Search Console API, which is how the Indexer console's pipeline submits sitemaps it syncs.

The protocol also documents an HTTP ping form, a one line GET per engine. It still exists in the spec, but Google retired its ping endpoint in 2023, so the reliable channels are the two above plus robots.txt.

Check your own sitemap#

The theory above is checkable. Paste a sitemap.xml, or a sitemap index, into the box and the checker parses it locally in your browser and reports what an engine would object to: the limit proximity, duplicate and overlong URLs, invalid lastmod values, the escaping failures that break parsing, and the fields Google ignores. It comes preloaded with a deliberately imperfect example so the report is populated on first render.

Sitemap checker

Check your sitemap.xml

Paste a sitemap or a sitemap index. The checker parses it in your browser and reports the limits, duplicates, date problems and off-host URLs an engine would drop. Nothing is uploaded; the file never leaves this page.

What a sitemap cannot do#

The honest limits, one paragraph each.

A sitemap does not force indexing. It shortens discovery, and that is all. A page that is thin, duplicated, blocked by robots.txt or marked noindex stays out of the index no matter how many times it is listed, and the verdict vocabulary for the failure modes lives in this blog's guide on the reasons sites stay off Google.

A sitemap does not replace links. Internal linking remains a discovery channel and a relevance signal, and a page reachable only through a sitemap is weaker for it. The two mechanisms complement, and large sites do the math on both.

A sitemap does not need every URL. Filtered facets, parameter permutations and near duplicate pages belong out of the file, because every low value entry is crawl budget spent finding nothing. The 404 entries are worse than wasted, and this blog's 404s in sitemap guide covers that failure mode end to end.

The maintenance loop#

A sitemap is infrastructure, and the loop has three beats. Regenerate on publish, so new pages appear and removed pages disappear, the same sync the Indexer console automates every two hours on paid tiers. Keep lastmod honest, stamping the page's real change date, because the field is only read while it is trusted. And watch the Search Console Sitemaps report, which surfaces the two states worth acting on: a file that could not be fetched, usually a permission or routing problem, and a discovered URL count far below the listed count, which means entries are being dropped, most often by the location rule or by redirects.

Monthly is a sane review cadence for a site that publishes steadily, and the checker above works as the pre flight sanity pass before a big regeneration.

FAQ#

Does a sitemap guarantee my pages get indexed?#

No. A sitemap is a discovery hint. It puts your URLs in front of the engine's scheduler, and the engine still decides what to crawl and what to index based on the page itself: its content, its canonical status, its robots and noindex signals. Sites are indexed without any sitemap, and sites with perfect sitemaps stay unindexed when the pages have problems.

Do I need a sitemap if Google already crawls my site?#

Not strictly, and Google's own guidance says small sites under about 500 pages with sound internal linking may skip one. The practical case for having it anyway is change detection: lastmod tells the engine which known pages changed, and new deep pages surface immediately instead of waiting for the crawler to reach them through links.

What happens if my sitemap exceeds 50,000 URLs or 50MB?#

Engines stop reading the file past the limit. The fix is splitting into multiple sitemap files and adding a sitemap index that lists them, then submitting or announcing the index instead of the individual files. The index holds up to 50,000 child files, which covers every realistic catalog.

Should I keep changefreq and priority in my sitemap?#

Google ignores both fields, and the protocol itself calls them hints rather than commands. Keeping them costs file size and nothing else, so legacy sitemaps can stay as they are. New sitemaps are cleaner with just loc and lastmod, and that pair is what the engines actually consume.

Sources#

Further reading#

Put this into practice. Indexer submits URLs to the Google Indexing API and IndexNow, audits coverage with Search Console, and shows exactly which pages are indexed. Start for free or see how it works.

X LinkedIn Hacker News Reddit View as Markdown text/markdown · for AI readers
Arrow keys move through results. Enter opens the selected page. Escape closes.