XML Sitemap Guide: Why Every Website Needs One
An XML sitemap is a list of URLs you're handing to search engines saying "these are the pages I want you to know about." That's the whole job: discovery. It is not a ranking signal, and, the part that disappoints people, listing a URL in your sitemap does not guarantee it gets indexed. Google treats the sitemap as a suggestion. It still decides, page by page, whether each URL is worth indexing based on content quality, crawlability, and whether the page contradicts itself with other signals.
Understanding that boundary is what separates a sitemap that helps from one that actively confuses Google. A clean sitemap full of pages you genuinely want indexed speeds up discovery. A messy one full of redirects and dead URLs trains Google to trust it less.
The one rule that governs everything you include
Every URL in your sitemap should satisfy all three of these. If a URL fails even one, it doesn't belong:
- It returns 200 OK, not a 301/302 redirect, not a 404, not a 500.
- It's the canonical URL, the version you actually want ranked, not a parameter variant or duplicate. (If you're unsure which version that is, see our canonical tags guide.)
- It's indexable: no
noindextag, not blocked by robots.txt.
Here's why each matters, and what including the wrong thing tells Google:
| Should it be in the sitemap? | URL type | Why |
| --- | --- | --- |
| ✅ Yes | Canonical, 200, indexable pages | These are exactly what the sitemap is for |
| ❌ No | Redirected URLs (301/302) | You're advertising a URL that just bounces, wasting crawl |
| ❌ No | 404 / 410 / 5xx URLs | Dead URLs in a sitemap signal carelessness |
| ❌ No | noindex pages | Contradiction: "find this" + "don't index this" |
| ❌ No | Non-canonical duplicates (?utm=, ?sort=) | Splits signals, invites duplicate-content confusion |
| ❌ No | URLs disallowed in robots.txt | Google can't crawl them anyway |
The contradiction case is the costly one. A noindex page in your sitemap sends Google two opposite instructions at once. At best it's ignored; at worst it erodes how much Google trusts the whole file.
A correct entry, and what's optional
A minimal valid sitemap looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/blog/sitemap-guide</loc>
<lastmod>2026-06-14</lastmod>
</url>
</urlset>
Only <loc> is required. The optional tags deserve a reality check, because old guides overstate them:
<lastmod>is genuinely useful, but only if it's honest. Google has publicly said it largely ignores<lastmod>from sites that lie, meaning ones that stamp today's date on every URL on every crawl. Set it to the date the content meaningfully changed (a real edit, not a deploy that touched the file). An honest<lastmod>is one of the few signals that helps Google prioritize re-crawling your updated pages first.<priority>and<changefreq>are effectively dead. Google has said it ignores both. Don't spend time tuning numbers that nothing reads. If your generator emits them, fine, but they change nothing.
Size limits and the sitemap index
A single sitemap file caps at 50,000 URLs or 50 MB uncompressed, whichever you hit first. Cross either and the file is invalid past the limit.
Real sites blow past this, so you split into multiple sitemaps and tie them together with a sitemap index, a sitemap that lists other sitemaps:
<?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-06-14</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-products.xml</loc>
<lastmod>2026-06-10</lastmod>
</sitemap>
</sitemapindex>
Splitting by content type (posts, products, pages) has a practical payoff beyond the size cap: in Google Search Console you can submit each child sitemap separately and see indexing coverage per section. If "products" shows 8,000 submitted but 2,000 indexed, you've isolated where the problem lives instead of staring at one undifferentiated number. You can gzip sitemaps to save bandwidth; the 50 MB limit applies to the uncompressed size.
Submitting it and reading the results
Two things to do once your sitemap is live:
- Reference it in robots.txt so any crawler finds it automatically:
Sitemap: https://example.com/sitemap.xml. (More on that file in our robots.txt guide.) - Submit it in Google Search Console under Sitemaps. This is also where you monitor it; the "Submitted vs. Indexed" gap is the number that actually matters. A large gap means Google is finding your pages but choosing not to index many of them, which points to content or duplication issues, not a sitemap problem.
To generate a valid file without hand-editing XML, paste your URLs into our Sitemap Generator, which produces correctly-formatted output you can drop straight onto your server.
Frequently Asked Questions
Does adding a page to my sitemap guarantee it gets indexed?
No. A sitemap aids discovery; it helps Google find URLs faster. Google still decides independently whether to index each page based on quality, crawlability, and whether other signals contradict it. The "Submitted vs. Indexed" report in Search Console shows how many of your sitemap URLs actually made it in.
What are the size limits for an XML sitemap?
50,000 URLs and 50 MB uncompressed per file. If you exceed either, split your URLs across multiple sitemaps and list them in a sitemap index file. You can gzip the files; the 50 MB limit applies to the uncompressed size.
Should I set lastmod on every URL?
Only with accurate dates. <lastmod> should reflect when the page's content meaningfully changed. Google ignores <lastmod> from sites that stamp the current date on everything, so dishonest dates make the signal worthless. Leave it off rather than fake it.
Do priority and changefreq tags do anything?
Not for Google; it has stated it ignores both. They're harmless if present but pointless to tune. Spend your effort on accurate <lastmod> and on keeping the URL list clean.
Should I include noindex or redirected pages in my sitemap?
No. Include only canonical, indexable URLs that return 200 OK. A noindex page in a sitemap sends Google contradictory instructions, and redirected or 404 URLs waste crawl budget and reduce trust in the file.
Do small websites need an XML sitemap?
A small site with solid internal linking can be crawled fine without one, but a sitemap rarely hurts and helps Google discover pages faster, especially new pages and anything not well-linked internally. For most sites it's worth having.