Technical SEO

XML Sitemaps: How to Create, Submit and Fix Them for SEO

XML sitemaps for SEO: what a sitemap does, what to include and leave out, size limits, lastmod, how to submit it, and how to read the Sitemaps report.

XML Sitemaps. A map of the pages you want found. Illustrated with a code window listing pages with the date lines highlighted.

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

  1. Search Console: open the Sitemaps report, enter the sitemap URL (or index URL) and submit.
  2. robots.txt: add a line with the full URL, which lets other search engines find it:
Sitemap: https://www.example.com/sitemap-index.xml
  1. 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.

Opens in a new tab

Frequently asked questions

What is an XML sitemap?

An XML sitemap is a file that lists the URLs on your site you want search engines to find, optionally with the date each was last significantly changed. It helps search engines discover pages, especially new ones, pages with few internal links, and pages on large or frequently updated sites.

Do I need an XML sitemap?

Most sites benefit from one, and most platforms create one automatically. It matters most for large sites, new sites with few external links, sites with pages that aren't well linked internally, and sites that publish or change content often. A small, well-linked site can be found without one, but it does no harm.

How many URLs can an XML sitemap contain?

Each sitemap can list up to 50,000 URLs or be up to 50MB uncompressed, whichever comes first. Larger sites split URLs across several sitemaps and list them in a sitemap index file, which you can submit as one file.

Does Google use priority and changefreq in sitemaps?

No. Google says it ignores the priority and changefreq values. It uses lastmod only when it's consistently and verifiably accurate, reflecting the last significant change to the page.

Which pages should not be in my sitemap?

Leave out URLs you don't want in search results: redirects, error pages, noindexed pages, duplicates that canonicalize elsewhere, filter and parameter variations, and pages blocked by robots.txt. Including them sends mixed signals and makes the Sitemaps report noisier.

How do I submit my sitemap to Google?

Submit it in Search Console's Sitemaps report, and add a Sitemap line with its full URL to your robots.txt file so other search engines can find it too. Submission is a hint, not a guarantee that every URL will be crawled or indexed.

Why does Search Console say my sitemap couldn't be fetched?

Usually because the URL is wrong, the file returns an error or redirect, it's blocked by robots.txt or a firewall, or the server timed out. Open the sitemap URL in a browser, check it returns 200 with valid XML, and resubmit.

See how this applies to your own site

A free SEO audit shows where you stand today, before you commit to anything else.