How to Build a Sitemap Index File
A sitemap index file is a master sitemap that points to other sitemaps rather than directly to URLs. It solves the problem of the 50,000 URL per sitemap limit and provides a clean organizational structure for large sites with diverse content types. Building one correctly ensures all your sub-sitemaps are discoverable from a single entry point submitted to Google Search Console.
When Do You Need a Sitemap Index?
You need a sitemap index when your site has more than 50,000 URLs (the per-file limit), when you want to separate sitemaps by content type (pages vs. posts vs. products), when different sections of your site are updated at different frequencies, or when you want modular control over which sitemaps to submit and track in GSC. Even for smaller sites, many SEOs prefer a sitemap index for the clean organization it provides — submitting one URL to GSC that routes to all content types.
The Sitemap Index XML Structure
A sitemap index file uses the sitemapindex root element instead of urlset, and contains sitemap child elements (not url). Each sitemap entry has a required loc and an optional lastmod:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-pages.xml</loc>
<lastmod>2026-04-27</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-posts.xml</loc>
<lastmod>2026-04-27</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-products.xml</loc>
<lastmod>2026-04-20</lastmod>
</sitemap>
</sitemapindex>The namespace declaration xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" is required. Each <loc> must be an absolute URL pointing to a valid child sitemap.
Organizing Child Sitemaps
The most common organization strategy is by content type: one sitemap for static pages, one for blog posts, one for products, and separate ones for images or videos if needed. Another approach is organization by date — monthly or yearly sitemaps for archives. For very large e-commerce sites, sitemaps by category work well. The key principle is that each child sitemap should contain URLs of a similar type or update frequency, making it easy to track indexing metrics per content type in GSC.
Sitemap Index Size Limits
A single sitemap index file can reference up to 50,000 child sitemaps and must not exceed 50 MB uncompressed. In practice, very few sites ever approach these limits at the index level. Each child sitemap can itself contain up to 50,000 URLs, meaning a single sitemap index can theoretically cover up to 2.5 billion URLs — far more than any website would need. The practical limit is keeping each child sitemap focused, well-organized, and under the URL count limit to maintain clear diagnostic reporting in GSC.
Using Lastmod in the Sitemap Index
The lastmod in a sitemap index entry tells Googlebot when that child sitemap was last updated. If the lastmod hasn't changed since Googlebot last fetched it, the crawler may skip re-fetching that child to save bandwidth. This is an important optimization for large sites — only update a child sitemap's lastmod in the index when that child's content has actually changed. If your product sitemap is updated daily but your pages sitemap is updated monthly, reflect that accurately in the index-level lastmod values.
Submitting a Sitemap Index to Google
Submit only the sitemap index URL to Google Search Console — not each individual child sitemap. GSC will crawl the index, discover all child sitemaps, and report metrics at the index level. You'll see the total URLs submitted across all child sitemaps. If needed, you can also add the sitemap index URL to your robots.txt Sitemap: directive. There is no need to submit each child sitemap separately — the index handles discovery automatically.
Common Sitemap Index Errors
The most frequent errors in sitemap index files are: child sitemap URLs that return 404 or 5xx errors, child sitemaps that are themselves sitemap index files (nesting is not permitted by the sitemaps.org protocol), incorrect namespace on the root element, and lastmod values that are identical for all entries regardless of actual update times. Validate your sitemap index with SitemapFixer or an XML validator after building it to catch these before submission.
Sitemap Index vs. Single Large Sitemap
For sites under 50,000 URLs, a single sitemap file works perfectly and is simpler to maintain. The primary advantages of a sitemap index are organizational clarity, per-content-type metrics in GSC, and the ability to exceed the 50,000 URL per-file limit. If you're starting fresh and expect your site to grow significantly, building a sitemap index from the start avoids a disruptive migration later. Most modern CMS plugins and frameworks generate sitemap indexes automatically once a threshold is reached.