- An XML sitemap lists URLs you want search engines to discover; it does not guarantee indexing.
- Include canonical, indexable URLs that return 200, not redirects, blocked pages or pages marked noindex.
- Split files before either limit: 50,000 URLs or 50 MB uncompressed. A sitemap index can list the resulting files.
- Keep lastmod accurate and submit the sitemap to Google and Bing. Check it with the free sitemap validator.
What is an XML sitemap?
An XML sitemap is a machine-readable file listing the URLs you want search engines to discover, with optional information such as when a page last changed. It is a discovery aid, not an instruction to index every URL. Google's sitemap overview explains both its uses and its limits: submitting a sitemap does not guarantee that listed pages will be crawled or indexed.
Think of the sitemap as a clean inventory of your preferred public pages. It complements navigation and internal links; it cannot replace them or make a weak, inaccessible page eligible for search. A sitemap URL is also a canonical signal, so list the version you actually want shown rather than every URL that leads to the same content. Google's building guide recommends listing canonical URLs.
When does a site need one?
A small, well-linked site may not need a sitemap. It is especially useful when a site is large, new and has few external links, has pages that are isolated from each other, or contains rich media or news content. These are examples from Google's guidance, not a rule that every small site should skip one. If a CMS generates a sitemap, inspect it even if the site is small: a clean inventory makes maintenance easier.
Start by opening the sitemap URL in a browser and checking that it loads publicly. Then use the free XML sitemap validator to check its structure and sample its URLs. A successful file response alone does not mean all the pages inside are suitable for indexing.
A minimal XML sitemap example
This example lists one page using a fully qualified URL. The XML declaration, namespace and urlset wrapper identify the format; url contains an entry and loc gives its address. Google's format examples explain the required elements.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/guide/</loc>
</url>
</urlset>
Replace the example with the exact live URL, including its protocol, host and preferred trailing slash. Save the file as UTF-8. XML values must be escaped: for example, a query string ampersand is written as & in the XML source. Do not paste HTML tags around the file contents. See the Sitemaps protocol for encoding and entity escaping.
What should a sitemap include?
Include only canonical, indexable URLs that return HTTP 200 and that you want in search results. Typically these are public product, service, category and editorial pages with their own useful content. Use absolute URLs and make the sitemap agree with your canonical tags, internal links and preferred host. Google describes sitemap URLs as a canonicalization signal in its duplicate URL guidance.
- Exclude redirects and errors. List the final 200 destination instead of an old address that redirects, and remove missing or broken URLs.
- Exclude noindex pages. A sitemap asks for discovery of a URL while noindex asks for exclusion from search. Decide which outcome you want and keep the signals consistent.
- Exclude URLs blocked to search crawlers. Fix an accidental robots.txt block on a page intended for search; omit deliberately blocked URLs. A sitemap does not override robots.txt.
- Exclude duplicate variants. Do not list tracking parameters, alternate hosts or other duplicates when another URL is the chosen canonical.
Check representative live pages with the indexability checker, and use the robots.txt tester to investigate crawl rules. Our robots.txt guide explains how those rules work. Google notes that a crawler must be able to access a page to see its noindex rule, so blocking it is not a substitute for noindex.
Keep the inventory current when pages are published, removed or redirected. If a URL is intentionally removed from search, removing it from the sitemap alone is not a removal mechanism. Review the page's actual response and indexing directives as well as the sitemap entry.
Sitemap limits and sitemap index files
A single sitemap is limited to 50,000 URLs or 50 MB uncompressed, whichever limit is reached first. Compression can reduce transfer size, but it does not change the uncompressed limit. If either limit is exceeded, split the URLs across multiple files. Google's sitemap documentation specifies both limits.
A sitemap index is a separate XML file that lists sitemap files rather than individual pages. It is useful after splitting a large sitemap, or when you want to organize separate inventories. You can submit the index in place of submitting each child separately. An index follows the same size limits; Google also documents location restrictions for its child files in its sitemap index guide.
<?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></sitemap>
<sitemap><loc>https://example.com/sitemap-posts.xml</loc></sitemap>
</sitemapindex>
Each child should be reachable and valid on its own. An index is not a shortcut around the per-file limit: check the child files as well as the index. Placing the index at the site root is a practical way to avoid restrictive directory scope; consult Google's location guidance if your setup needs files elsewhere.
How to use sitemap lastmod
The optional lastmod inside a URL entry records the page's last significant update, for example <lastmod>2026-11-04</lastmod>. Google says it uses this value when it is consistently and verifiably accurate. Changes to main content, structured data or links can be significant; a copyright date change alone is not. Google ignores changefreq and priority. See its lastmod guidance.
Use a real content modification timestamp from your publishing system, not the time the sitemap was generated or fetched. Do not update every entry simply to make pages look fresh. If your system cannot provide a reliable date, omit the optional field until it can. In a sitemap index, a lastmod attached to a child entry refers to the sitemap file's modification, not each individual page; Google's index reference makes that distinction.
Submit a sitemap to Google and Bing
Publish the sitemap at a stable, publicly accessible URL. Add its absolute address to the site's robots.txt, outside the crawler groups, for example:
Sitemap: https://example.com/sitemap.xml
For a split inventory, point this line to the sitemap index. Google documents the robots.txt sitemap line and Search Console submission. In Google Search Console, select the verified property, open the Sitemaps report, enter the sitemap or index URL and submit it. Return to the report to review whether Google could fetch and process the file. Submission is a hint, not a promise of indexing.
In Bing Webmaster Tools, verify your site, open Sitemaps and submit the same public sitemap or index. Bing also supports discovery via the robots.txt line; its setup guide describes both options. Our Bing Webmaster Tools guide covers verification and reports.
For Bing, use IndexNow alongside the sitemap to notify participating search engines when URLs are added, changed or deleted. It is a notification mechanism, not a guarantee of crawling or indexing. Your CMS, plugin or CDN may provide an integration; follow its setup instructions and verify the key. Bing recommends keeping a complete sitemap even when using IndexNow in its sitemap guidance.
Common sitemap errors and fixes
Start with the reported file, then inspect a sample of the actual URLs. Google's Sitemaps report documentation explains report status and errors.
| Error | Cause | Fix |
|---|---|---|
| File cannot be fetched | Wrong address, access restriction or server error. | Open the public URL, correct the address or server response, and submit again. |
| Invalid XML | Broken tags, namespace or unescaped characters. | Fix the XML syntax and validate the resulting file. |
| Redirect or missing URL | Old URLs remain after a move or deletion. | List the final indexable 200 URL, or remove the entry. |
| Blocked or noindex URL | Publishing rules and sitemap generation disagree. | Correct the rule for pages intended for search, or omit the URL. |
| File exceeds a limit | Too many URLs or too much uncompressed XML. | Split it into compliant files and list them in an index. |
| Unreliable lastmod | Dates change on every build or do not reflect content edits. | Use the real significant update date or omit the field. |
Run the sitemap validator again after fixing the file, then check search engine reports. If the sitemap is accepted but a page is still absent, look at its crawl and indexing status rather than repeatedly submitting it. Our guide to crawled, currently not indexed explains the next checks. MrKeyword can help inspect the file and pages; it cannot force a search engine to index them.
Questions and answers
XML sitemaps questions
What is an XML sitemap?
It is a machine-readable list of URLs you want search engines to discover, optionally including information such as the last significant update.
How many URLs can a sitemap contain?
A sitemap can contain up to 50,000 URLs and be no larger than 50 MB uncompressed. Split it if either limit is exceeded.
Does a sitemap guarantee indexing?
No. A sitemap helps discovery but does not guarantee crawling or indexing.
Does Google use sitemap lastmod?
Google uses lastmod when it is consistently and verifiably accurate, and ignores changefreq and priority.
Sources
- Build and submit a sitemap — Google Search Central: formats, limits, lastmod and submission
- Manage sitemaps with sitemap index files — Google Search Central: sitemap indexes and location requirements
- Keeping content discoverable with sitemaps — Bing: sitemaps and IndexNow

