An XML sitemap is a file that lists the pages on your site you want search engines to find, optionally with the date each one last changed meaningfully. For SEO, XML sitemaps help search engines discover new pages quickly, find pages that aren’t well linked, and understand which URLs you consider canonical. They don’t make pages rank, and they don’t force anything to be indexed, but a clean, accurate sitemap removes a source of doubt and gives you one of the most useful diagnostic reports in Search Console.
This guide covers what XML sitemaps do, what to include and leave out, Google’s limits and rules, how to create and submit one, and how to read and fix the Sitemaps report.
The short version
- List the canonical, indexable URLs you want in search results, and nothing else.
- Limits: 50,000 URLs or 50MB uncompressed per sitemap; use a sitemap index for more.
- Absolute URLs, UTF-8, ideally at the site root.
- Google ignores priority and changefreq; it uses lastmod only when it’s accurate.
- Submit in Search Console and reference the sitemap in robots.txt.
- Use the Sitemaps report to spot fetch errors and pages that aren’t being indexed.
What an XML sitemap does, and doesn’t do
Google’s sitemap overview explains that sitemaps help search engines crawl a site more efficiently, and that they’re most useful for large sites, new sites with few external links, sites with pages that are poorly linked internally, and sites with rich media or news content.
What a sitemap doesn’t do:
- It doesn’t guarantee crawling or indexing. Google describes submitting a sitemap as a hint.
- It doesn’t replace internal links. Pages that matter should still be linked from other pages.
- It doesn’t override other signals. A URL listed in the sitemap but canonicalized elsewhere or set to noindex won’t be indexed because of the sitemap.
Google’s sitemap rules
From Google’s guide to building and submitting a sitemap:
| Rule | Detail |
|---|---|
| Size limit | 50,000 URLs or 50MB uncompressed per sitemap; split larger sets |
| Sitemap index | Lists several sitemaps; you can submit just the index |
| URLs | Fully qualified, absolute URLs, crawled exactly as listed |
| Encoding | UTF-8 |
| Location | Anywhere, but at the root it can cover the whole site; without Search Console submission, a sitemap only affects its own directory and below |
| What to list | URLs you want in search results, ideally canonical ones |
| priority and changefreq | Ignored by Google |
| lastmod | Used only if consistently and verifiably accurate |
The format itself is defined by the sitemaps.org protocol, which other search engines also follow.
What a sitemap looks like
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/services/boiler-repair/</loc>
<lastmod>2026-11-02</lastmod>
</url>
<url>
<loc>https://www.example.com/guides/boiler-pressure-too-high/</loc>
<lastmod>2026-10-18</lastmod>
</url>
</urlset>
And a sitemap index for larger sites:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://www.example.com/sitemap-pages.xml</loc></sitemap>
<sitemap><loc>https://www.example.com/sitemap-products.xml</loc></sitemap>
<sitemap><loc>https://www.example.com/sitemap-guides.xml</loc></sitemap>
</sitemapindex>
Splitting by section (pages, products, guides) isn’t required, but it makes the Sitemaps report far more useful: you can see indexing problems for each part of the site separately.
What to include, and what to leave out
| Include | Leave out |
|---|---|
| Canonical URLs of pages you want to rank | URLs that redirect |
| New and recently updated pages | Pages returning errors (404, 410, 5xx) |
| Important pages that are hard to reach by links | Pages with noindex |
| Category, product, service, location and guide pages | Duplicates that canonicalize to another URL |
| Images and videos (in image or video sitemaps) where they matter | Filter, sort and tracking-parameter URLs |
| Pages blocked by robots.txt | |
| Thin archive or tag pages you don’t want indexed |
A sitemap full of URLs that redirect, error or aren’t meant to be indexed tells search engines the file isn’t reliable, and makes your own reports harder to read. On our own site, for example, the sitemap filter leaves out thank-you pages, noindexed tag archives and any page carrying a noindex tag, so only pages meant to rank are listed.
Using lastmod properly
Google uses lastmod only when it’s accurate, meaning it should reflect the last significant change to the page: main content, structured data or links. Updating every date daily, or changing dates for trivial edits like a footer copyright year, teaches search engines to ignore your lastmod values. Let your CMS set lastmod from real content changes.
How to create an XML sitemap
- WordPress: WordPress creates a basic sitemap at
/wp-sitemap.xml; SEO plugins such as Yoast and Rank Math replace it with their own, with more control over what’s included. - Shopify and most hosted platforms: generate a sitemap automatically, usually at
/sitemap.xml. - Static site generators and frameworks: use the framework’s sitemap integration, configured to exclude non-indexable pages.
- Custom sites: generate the sitemap from your database or routes so it always matches the live site. Avoid hand-maintained files, which drift out of date.
Whatever the method, check the output: open the sitemap in a browser and confirm it lists only the URLs you expect.
How to submit your sitemap
- Search Console: open the Sitemaps report, enter the sitemap URL (or index URL) and submit.
- robots.txt: add a line with the full URL, which lets other search engines find it:
Sitemap: https://www.example.com/sitemap-index.xml
- Bing Webmaster Tools: submit there too, or rely on the robots.txt reference.
You don’t need to resubmit after every change; search engines refetch sitemaps periodically. Resubmit after major changes such as a migration.
Reading the Sitemaps report
Search Console’s Sitemaps report shows each submitted sitemap, when Google last read it, its status and how many URLs it discovered. From there you can open page indexing details for just the URLs in that sitemap.
| Status | Meaning | What to do |
|---|---|---|
| Success | Fetched and processed | Check page indexing for its URLs |
| Couldn’t fetch | Google couldn’t retrieve the file | Check the URL, status code, robots.txt and firewall |
| Has errors | Fetched but with problems, such as invalid XML or URLs | Open the details, fix the format or URLs |
The most valuable view is the page indexing report filtered to a sitemap. It shows which listed URLs aren’t indexed and why: crawled but not indexed, discovered but not indexed, duplicates, redirects or noindex. Since a sitemap should only list pages you want indexed, every non-indexed URL there is either a problem to fix or a URL that shouldn’t be listed. Our guide to Discovered – currently not indexed covers one of the most common statuses.
Special sitemaps
- Image sitemaps help search engines find images that load in ways crawlers might miss.
- Video sitemaps add details about videos on your pages.
- News sitemaps are for publishers in Google News.
- hreflang in sitemaps lists language and regional alternates for each URL, an alternative to adding hreflang tags to every page.
Sitemaps for large and fast-changing sites
On shops, marketplaces and large content sites, the sitemap does more work:
- Segment by type and section (products, categories, guides, locations) so you can see indexing rates for each in Search Console.
- Keep it generated from live data, so new products appear immediately and discontinued ones disappear.
- Use accurate lastmod so search engines can focus recrawling on pages that really changed, such as price or stock updates.
- Watch the ratio of submitted to indexed URLs per sitemap. A falling ratio for one section usually points to a template or content problem in that section.
Sitemaps during a migration
When URLs change, submit a sitemap of the new URLs. Google’s guidance also suggests keeping a sitemap of the old URLs available for a while after a move, so it can find the redirects quickly; the redirect warnings that sitemap produces are expected. Remove it once the old URLs have dropped out of the index. Our site migration guide covers the full process.
A quick sitemap audit
- Sitemap URL loads with a 200 status and valid XML
- Referenced in robots.txt and submitted in Search Console
- Every URL uses your canonical protocol and host
- No redirects, errors, noindexed or canonicalized-away URLs (crawl the sitemap’s URLs to check)
- lastmod reflects real content changes
- Within the size limits, or split with an index
- Sitemaps report shows recent successful reads
- Non-indexed URLs from the sitemap reviewed and explained
Common XML sitemap mistakes
| Mistake | Fix |
|---|---|
| Listing redirects, 404s or noindexed pages | Generate the sitemap only from indexable, canonical URLs |
| Using http or non-www URLs on an https/www site | Match your canonical protocol and host exactly |
| Fake lastmod dates updated daily | Set lastmod from real content changes |
| One giant sitemap over the limits | Split into several files with an index |
| Stale hand-made sitemap | Generate it automatically |
| Sitemap blocked by robots.txt or a firewall | Allow search engines to fetch it |
| Staging URLs in the live sitemap | Check the domain in every URL |
Keep your sitemap clean
A sitemap should be a precise list of the pages you want to rank, kept current automatically. Get that right and the Sitemaps report becomes a reliable early warning for indexing problems. Our technical SEO guide covers crawling and indexing more broadly, and our technical SEO team can audit your sitemaps alongside canonicals, redirects and indexing.
