What an XML sitemap is and is not
An XML sitemap is a file that lists the URLs on your site you want search engines to crawl, with an optional date each page last changed. It helps crawlers discover pages, especially new pages, pages with few internal links and pages on large sites.
Search engines treat a sitemap as a hint. Listing a page doesn't force it into the index or raise its ranking. Pages still need internal links so visitors and crawlers can reach them from the rest of the site.
The sitemap format
The format comes from the Sitemaps protocol published at sitemaps.org, which Google, Bing and other search engines support. The file is UTF-8 encoded XML with a urlset root element in the protocol namespace.
Each page is a url element with a required loc, the page's absolute URL including https://. The optional lastmod gives the date of the last significant change, as a date or a full timestamp in W3C Datetime format.
The protocol also defines changefreq and priority, but Google ignores both. Google uses lastmod only when it is consistently accurate, so change it when the content changes, not on every build. Escape special characters in URLs as XML entities, such as & for an ampersand.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-10-20</lastmod>
</url>
<url>
<loc>https://www.example.com/guides/sitemaps</loc>
<lastmod>2026-09-02T14:30:00+00:00</lastmod>
</url>
</urlset>Size limits and sitemap index files
Each sitemap file can list up to 50,000 URLs and must be no larger than 50 MB uncompressed. You can gzip a sitemap to save bandwidth, but the limit still applies to the uncompressed size.
A larger site splits its URLs across several sitemaps, often by section or content type, and lists them in a sitemap index file. The index uses sitemapindex and sitemap elements, each with a loc and an optional lastmod. Under the protocol, one index can list up to 50,000 sitemaps.
Submitting the index is enough, since search engines read the sitemaps it lists.
<?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>
<lastmod>2026-10-20</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-posts.xml.gz</loc>
</sitemap>
</sitemapindex>Where to declare your sitemap
Add a Sitemap line with the full URL to robots.txt, for example Sitemap: https://www.example.com/sitemap.xml. The line can go anywhere in the file, applies to all crawlers, and can be repeated for several sitemaps.
Also submit the sitemap in Google Search Console's Sitemaps report and in Bing Webmaster Tools. Those reports show when the file was last read and which URLs had problems. Google retired its sitemap ping endpoint in 2023, so don't rely on pinging.
Host sitemaps at the site root. Unless you submit a sitemap through Search Console, Google applies it only to URLs inside the folder that contains it.
Which URLs to include and which to leave out
List the URLs you want in search results, in exactly the form you use in canonical links: the same protocol, hostname and trailing-slash style. Generate the sitemap from your CMS or build process so it changes when pages are added or removed.
Leave out URLs that send a conflicting signal:
- Redirecting URLs, and URLs that return 404, 410 or a server error
- Pages marked noindex, and pages blocked in robots.txt
- Duplicates whose canonical points to another URL, including sort, filter and tracking parameters
- Internal search results, login pages, carts and checkout steps
- Staging and test hosts