An XML sitemap is a file that lists the URLs on your website you want search engines to know about, along with optional details such as when each page last changed. Think of it as a table of contents written for crawlers rather than people.
A sitemap won't fix weak content or force anything into Google. What it does is make discovery easier, especially for new, large or poorly linked sites. Here is how it works and how to build one that search engines actually trust.
What is an XML sitemap?
An XML sitemap is a structured file, usually found at a URL like https://www.example.com/sitemap.xml, that follows the sitemaps.org protocol. Each entry sits inside a url element and must include a loc tag with the page's full address. Optional tags include lastmod (last modified date), changefreq and priority.
Google describes a sitemap as a file that tells it about your pages and files and how they relate, so it can crawl more efficiently. Sitemaps can also carry extra details for images, videos, news articles and alternate language versions.
Why XML sitemaps matter
Search engines find pages mainly by following links during crawling. Google's How Search works guide lists submitted sitemaps as one of the ways it discovers URLs. If a page has few or no internal links pointing to it, a sitemap may be the only signal that it exists.
Google says sites most likely to benefit include large sites, new sites with few external links, and sites with lots of video, image or news content. Sites of about 500 pages or fewer that are well linked internally may not strictly need one. Even so, Google notes most sites benefit from having a sitemap, and it costs little to maintain.
Discovery also matters for AI search. Many AI answer engines draw on search indexes or their own crawls, so pages that are found and indexed quickly have more chances to be retrieved and cited. A sitemap does not guarantee that, but it removes one obstacle.
How XML sitemaps work
The format
The file opens with a urlset element that declares the sitemap namespace. Inside it, each page gets a url element with a loc tag and, ideally, an accurate lastmod date. The file must be UTF-8 encoded, and special characters such as ampersands must be escaped.
Size limits and sitemap indexes
Per Google's build guide, a single sitemap can hold up to 50,000 URLs or 50MB uncompressed. Larger sites split their URLs across several sitemaps and list them in a sitemap index file, which you can submit as one URL. Splitting by section, such as products, blog posts and categories, also makes reporting easier.
What Google reads (and ignores)
Google ignores the priority and changefreq tags. It uses lastmod only when the dates are consistently and verifiably accurate. Updating lastmod for trivial changes, such as a new copyright year, teaches Google to distrust the field.
How search engines find it
You can submit a sitemap in the Search Console Sitemaps report, submit it through the Search Console API, or add a "Sitemap:" line to your robots.txt file. Google announced in June 2023 that its old sitemap ping endpoint was going away, and it was set to stop working by the end of that year, so Search Console and robots.txt are the reliable routes today. Submission is a hint, not a command.
XML sitemaps in practice
Picture a growing B2B software company with a marketing site, a blog and a help center on the same domain. Its CMS creates a basic sitemap, but it includes tag archives, thin author pages and URLs that redirect.
A cleaner setup would use a sitemap index pointing to three child sitemaps: core pages, blog posts and help articles. Each would list only canonical, indexable URLs that return a 200 status, with lastmod dates that change only when the content meaningfully changes. In Search Console, the team could then see indexing coverage for each section separately.
Best practices for XML sitemaps
- List only URLs you want indexed. Leave out redirects, error pages, pages with a noindex tag and non-canonical duplicates. Each listed URL should match its canonical tag.
- Use absolute URLs. Google crawls the URLs exactly as listed, so include the protocol and the preferred host.
- Keep lastmod honest. Update it for real changes to main content, structured data or links.
- Automate it. Let your CMS or a plugin regenerate the sitemap when pages are added or removed. Most platforms, including WordPress, Wix and Webflow, can do this.
- Host it at the root. A sitemap placed in a subfolder only covers URLs in that folder unless you submit it in Search Console.
- Submit it and monitor it. Check the Sitemaps and Page Indexing reports for errors and for listed URLs Google chose not to index.
Common mistakes and misconceptions
- "A sitemap guarantees indexing." It doesn't. Google says listing a URL does not mean it will be crawled or indexed.
- "Priority tells Google what matters." Google ignores the priority tag. Internal links and content quality do that work.
- Stuffing every URL in. Including filtered, duplicate or noindexed pages sends mixed signals and makes your reports harder to read.
- Letting it go stale. A sitemap that still lists deleted pages, or misses new ones, quietly loses its usefulness.
XML sitemap vs. HTML sitemap
An HTML sitemap is a regular page for human visitors that links to sections of your site. An XML sitemap is a machine-readable file for crawlers. An HTML sitemap can add internal links, but it is not a substitute for an XML sitemap, and most modern sites rely on good navigation instead.
How Butter approaches XML sitemaps
At Butter, sitemaps are part of the indexing strategy we review every month. We check that your sitemap lists the pages you actually want found, that it doesn't contain redirects or noindexed URLs, and that it is submitted in Search Console. On the GEO+SEO plan, sitemap and crawl issues fall under the technical SEO fixes we handle, and the new articles we publish each month need to show up in your sitemap so they get discovered quickly. It is unglamorous work, but it helps your content get a fair shot at search and AI visibility. Details on what each plan covers are on our pricing page.
Frequently asked questions
Where do I find my website's XML sitemap?
Try yourdomain.com/sitemap.xml or yourdomain.com/sitemap_index.xml first. You can also check your robots.txt file for a "Sitemap:" line, or look in your CMS or SEO plugin settings.
How many URLs can one XML sitemap contain?
Up to 50,000 URLs or 50MB uncompressed, whichever comes first. If you have more, split them into several sitemaps and list those in a sitemap index file.
Do I need to resubmit my sitemap every time I publish?
No. Once Google knows your sitemap's location, it rechecks the file on its own schedule. Keep the sitemap updated automatically and make sure lastmod dates are accurate.
Does an XML sitemap help with AI search?
Indirectly. A sitemap helps search engines discover and index your pages, and many AI answer tools rely on search indexes or their own crawls. It cannot guarantee that an AI tool will cite your content.