AI Overview
An XML sitemap is a file listing the pages you want search engines to crawl and index. Keep it to canonical, indexable URLs that return 200, use accurate lastmod dates, add it to robots.txt, then submit it in Google Search Console.
Key takeaways
- An XML sitemap lists the URLs you want search engines to crawl and index, usually at /sitemap.xml on your site.
- Each sitemap file holds up to 50,000 URLs or 50 MB uncompressed, and larger sites use a sitemap index file.
- List only canonical, indexable pages that return 200, never redirects, 404s or noindexed URLs.
- Google uses lastmod only when it is consistently accurate and ignores priority and changefreq completely.
- Add a Sitemap line to robots.txt and submit it in Search Console, because Google retired its ping endpoint in 2023.
Summarize with AI
Opens the assistant in a new tab with a link to this post.
On this page
An XML sitemap is the list of pages you hand to search engines and say: these are the ones that matter. It won't make a weak page rank, but it helps Google find new and deep pages faster, understand which URL is the real one, and notice when content changes.
It's also one of the most quietly broken files on the web. Sitemaps full of redirects, 404s and noindexed pages. Sitemaps that stopped updating two years ago. Sitemaps that vanished after a theme change and nobody noticed.
This guide explains what an XML sitemap is, whether you need one, what to put in it, how to create and submit one, and how to fix the errors that make Google trust it less.
What is an XML sitemap?#
An XML sitemap is a file, usually at https://yoursite.com/sitemap.xml, that lists the URLs on your site you want search engines to crawl and index. It can also tell them when each page last changed.
Here's a minimal example:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-09-10</lastmod>
</url>
<url>
<loc>https://example.com/pricing</loc>
<lastmod>2026-08-28</lastmod>
</url>
</urlset>
Each <url> entry needs a <loc>: the full, absolute address of the page. Everything else is optional.
An XML sitemap is different from an HTML sitemap, which is a regular page with links for human visitors. This guide is about the XML kind, the one search engines read.
Do you need an XML sitemap?#
Google's own guidance is that a sitemap helps most when:
- Your site is large, so Google might miss some new or recently updated pages
- Your site is new and has few links from other sites
- Pages aren't well linked to each other, so crawling alone won't find them all
- You have lots of images, video or news content you want shown in search
Google also says you might not need one if your site is small (around 500 pages or fewer), every important page is linked from your navigation, and you don't rely on media or news results.
In practice, almost every site should still have one. It costs nothing, most platforms generate it automatically, and it gives you a useful health check in Search Console.
Sitemap rules and limits#
Google's documentation sets out the rules that trip people up most:
| Rule | What it means |
|---|---|
| 50,000 URLs or 50 MB per file | That's the limit uncompressed. Bigger sites split into several sitemaps |
| Sitemap index files | A sitemap that lists other sitemaps, so you submit one file for the whole site |
| Absolute URLs | https://example.com/page, never /page |
| UTF-8 encoding | Special characters must be properly encoded |
| Put it at the root | A sitemap affects only the folder it sits in and below, unless you submit it in Search Console |
A sitemap index looks like this:
<?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>
<sitemap><loc>https://example.com/sitemap-products.xml</loc></sitemap>
</sitemapindex>
Splitting by content type is useful even on smaller sites, because Search Console then shows indexing for each sitemap separately.
lastmod, changefreq and priority#
lastmod: Google uses it, but only if it's "consistently and verifiably accurate". Update it when the main content changes, not every time a footer or sidebar changes. If your sitemap claims everything changed yesterday, every day, Google stops believing it.changefreqandpriority: Google ignores both. You can leave them out.
Try it on your site · free
Check your own page's meta tags
Title, description, canonical and robots - including an accidental noindex - in a few seconds.
What to include, and what to leave out#
A sitemap should be a clean list of your best URLs. The rule is simple: include only canonical, indexable pages that return 200.
| Include | Leave out |
|---|---|
| Pages you want in search results | Pages with a noindex tag |
| The canonical version of each page | Duplicates that point to another canonical |
| URLs that return 200 | URLs that redirect or return 404 or 5xx |
The live protocol and hostname (for example https://www.) | http:// or other hostname versions |
Recently updated content, with an accurate lastmod | Internal search results, filters, cart and account pages |
Every bad URL in your sitemap makes it a less reliable signal. If you list pages that redirect or say noindex, you're telling Google two contradicting things. Our canonical tag guide explains why your sitemap and canonicals should always agree.
Special sitemaps: images, video, news and hreflang#
Google supports extensions for specific content:
- Image sitemaps list important images, useful when images load through JavaScript.
- Video sitemaps add details like title, description, duration and thumbnail.
- News sitemaps list articles published in the last two days, for sites in Google News.
- hreflang in sitemaps declares language and regional versions of a page, an alternative to tags in the page
<head>.
Most sites only need a standard sitemap. Add these when that type of content is important to your traffic.
How to create an XML sitemap#
You rarely need to write one by hand:
- WordPress has built-in sitemaps since version 5.5, at
/wp-sitemap.xml. SEO plugins like Yoast SEO and Rank Math replace it with their own, usually at/sitemap_index.xml, and let you exclude post types, taxonomies and individual pages. - Shopify generates
/sitemap.xmlautomatically, with child sitemaps for products, collections, pages and blog posts. - Wix, Squarespace and Webflow create one automatically too.
- Frameworks like Next.js, Nuxt, Astro and Hugo have built-in or plugin support, usually generated at build time from your routes and content.
- Small static sites can use an online sitemap generator, as long as you regenerate it when pages change.
Whichever you use, open the file in a browser afterwards and check it actually contains the pages you expect.
How to submit your sitemap to Google#
- Add it to robots.txt. One line, anywhere in the file:
Sitemap: https://example.com/sitemap.xml. Every search engine that reads robots.txt will find it. Our robots.txt guide covers the rest of that file. - Submit it in Google Search Console. Open Indexing > Sitemaps, enter the sitemap URL and click Submit. Google shows when it last read the file and how many URLs it found.
- Submit it in Bing Webmaster Tools too, if Bing traffic matters to you.
Don't bother "pinging" Google. Google announced in June 2023 that its sitemap ping endpoint was being retired, and it stopped working at the end of that year. Submission in Search Console and the robots.txt line are the supported methods.
Keep in mind that submitting a sitemap is a hint, not a command. It helps Google find your URLs, but it doesn't guarantee they'll be crawled or indexed.
How to read the Sitemaps report#
In Search Console, each submitted sitemap shows a status:
- Success: Google read the sitemap. Click it to see how many of its URLs are indexed in the Page indexing report.
- Has errors: Google read it but some entries couldn't be processed.
- Couldn't fetch: Google couldn't download the file at all.
Our guide on how to use Google Search Console walks through the indexing reports in more detail.
Common sitemap errors and how to fix them#
Couldn't fetch. The sitemap URL returns a 404, a server error, or is blocked. Open it in a private browser window, check it isn't blocked by robots.txt, a firewall or a login, and confirm it returns 200 with valid XML.
URLs that redirect. Usually left over from a migration or an http to https move. List the final URLs instead. A bulk URL status checker shows the final status of a list of sitemap URLs in one go.
URLs that return 404. Deleted pages that the sitemap never forgot. Regenerate the sitemap or fix the plugin that builds it.
Noindex URLs in the sitemap. Either the page should rank and the noindex is a mistake, or it shouldn't and it doesn't belong in the sitemap. Decide which, and fix it.
Wrong protocol or domain. http:// URLs on an https:// site, or example.com URLs on a www.example.com property. The sitemap must use the same version Google indexes.
Blocked by robots.txt. URLs in the sitemap that robots.txt disallows. Test them with a robots.txt tester.
A stale sitemap. New pages missing, deleted pages still listed. Usually a cache or a static file nobody regenerates.
How MyKavo helps keep your sitemap healthy#
MyKavo uses your sitemap from the start. When you add a website, it reads robots.txt, follows the sitemaps declared there (falling back to /sitemap.xml), works through sitemap indexes and combines the results with your homepage links, so you can pick the pages to monitor.
After that, it keeps watching:
- Site Audit checks your sitemap during each crawl and flags a missing sitemap, sitemap URLs that return errors, redirect or are noindexed, a robots.txt file with no Sitemap line, and orphan pages that only the sitemap links to.
- Monitoring compares your sitemap on every scan. If it stops being reachable, or loses more than half of its URLs (for sitemaps with 10 or more), MyKavo raises a high-severity alert, because that usually means a deploy or CMS change dropped pages. Smaller changes are recorded quietly, so normal publishing doesn't spam you.
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 crawl and index, often with the date each page last changed. It usually lives at /sitemap.xml.
Does every website need a sitemap?
Not strictly. Google says small, well-linked sites of around 500 pages or fewer may not need one. But most sites benefit, and most platforms create one automatically.
How many URLs can a sitemap have?
Up to 50,000 URLs or 50 MB uncompressed per file. Larger sites split their URLs into several sitemaps and list them in a sitemap index file.
Does Google use priority and changefreq?
No. Google ignores both. It uses lastmod, but only when the dates are consistently accurate.
How do I submit a sitemap to Google?
Add a Sitemap line to your robots.txt and submit the sitemap URL in the Sitemaps report in Google Search Console. Google retired its sitemap ping endpoint at the end of 2023.
Should noindex pages be in my sitemap?
No. A sitemap should only list canonical, indexable pages that return 200. Remove noindexed, redirecting and broken URLs.
The bottom line#
An XML sitemap is a short, clean list of the pages you want in search. Keep it to canonical, indexable 200 URLs, use accurate lastmod dates, skip priority and changefreq, reference it in robots.txt and submit it in Search Console. Then check the Sitemaps report regularly, because sitemaps break quietly when sites change.
Check that your sitemap URLs really return 200 with the free Bulk URL Status Checker, then start free with MyKavo to get alerted the day your sitemap disappears or loses half its pages.
Get alerted when your site breaks. Free, no card.
Start free