What is an XML sitemap?
Learn what XML sitemaps are, why they matter for SEO, and how to generate one automatically for any website.
What is an XML sitemap?
An XML sitemap is a file that lists the important pages on your website in a format search engines can read. It gives Google, Bing, and other engines a direct map of what exists on your site — including the URL of each page, when it last changed, and how important it is — so pages get found and indexed faster, even when they are not well linked internally.
An XML sitemap lists every important page on your website, formatted in a way that search engines can read and understand. Think of it as a table of contents for your site — one that you give directly to Google, Bing, and other search engines so they know exactly what exists.
Without a sitemap, search engines discover your pages by following links. That works for small, well-linked sites. But for larger sites, new pages, or any page that is not linked from somewhere else, a sitemap is the only reliable way to ensure it gets found.
A sitemap is not the same thing as your robots.txt file, and the two serve different jobs — one lists pages you want crawled, the other sets crawl rules. For the distinction, see sitemaps versus robots.txt.
Why sitemaps matter for SEO
Search engines have limited crawl budgets — the number of pages they will visit on your site in a given period. If your site has thousands of pages, Google might not find all of them on its own. A sitemap tells it exactly which pages exist, making sure none get missed. On large sites this matters even more, because the crawler has to spend its budget wisely — see crawl budget explained for how the two connect.
A good sitemap also helps search engines understand:
- Priority: which pages matter most on your site
- Change frequency: how often each page updates
- Last modified date: when a page was last changed
All of this helps Google decide how frequently to crawl your pages and how to rank them.
What goes in a sitemap?
A well-formed XML sitemap includes:
- The full URL of each page (
<loc>) - The last modified date (
<lastmod>) - How often it changes (
<changefreq>: daily, weekly, monthly) - Its relative priority (
<priority>: 0.0 to 1.0)
Here is 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/about</loc>
<lastmod>2026-03-15</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
Only <loc> is required. The other three tags are hints — Google treats <lastmod> as the most useful of them, and largely ignores <priority> and <changefreq> these days. A single sitemap file can hold up to 50,000 URLs or 50MB uncompressed, whichever comes first.
Sitemap vs sitemap index
Once a site grows past 50,000 URLs, one file is no longer enough. That is where a sitemap index comes in — a parent file that points to several child sitemaps rather than listing pages directly:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-posts.xml</loc>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-products.xml</loc>
</sitemap>
</sitemapindex>
You submit the index file to Google, and it reads every child sitemap listed inside. Most large sites split their sitemaps by content type — posts, products, categories — which also makes it easier to spot which section is out of sync. For a full walkthrough of splitting large sites, see sitemaps for large sites over 50,000 URLs.
Do you need a sitemap?
Not every site strictly needs one, but almost every site benefits. You want a sitemap if any of these apply:
- Your site has more than a few dozen pages
- You publish new content regularly
- Some pages are not linked from anywhere else on the site
- You have a large media library — images or video — you want indexed
- You run a store, news site, or documentation set that changes often
Small, static, fully linked sites can technically get by without one. But since a sitemap costs nothing to maintain when it is automated, the calculation almost always favors having one. If Google is already struggling to index your pages, a current sitemap is one of the first fixes — see why Google is not indexing your pages.
How to create one
There are three common paths:
- A CMS plugin — WordPress plugins like Yoast generate a sitemap from your content automatically. This works well when everything lives inside the CMS.
- A one-shot generator — enter your URL, download a
sitemap.xml, and upload it to your server. Fine for small sites, but it goes stale the moment you publish something new. - A crawler with scheduled updates — a tool crawls your live site and rebuilds the sitemap on a schedule, so it stays current on its own.
The trade-offs between these are worth understanding before you pick one — see the best sitemap generators compared. Whichever route you take, the next step is the same: submit your sitemap to Google Search Console so it starts getting crawled.
How Indexly generates your sitemap
Indexly crawls your website starting from your homepage, follows every internal link it finds, and builds a complete sitemap from the results. You get:
- A complete list of every crawlable page
- Automatic priority calculation based on link depth
- A hosted sitemap URL you can submit to Google Search Console
- Automatic updates on your chosen schedule
FAQ
What is an XML sitemap in simple terms?
An XML sitemap is a text file, written in a format search engines understand, that lists the important pages on your website. It works like a table of contents you hand directly to Google and Bing, telling them which pages exist and when each was last changed so they can find and index everything without relying only on internal links.
Is an XML sitemap required for SEO?
No, a sitemap is not strictly required. Search engines can still find pages by following links. But a sitemap makes discovery far more reliable, especially for large sites, new pages, or pages that are not linked from anywhere else. Since an automated sitemap costs nothing to maintain, most sites are better off having one.
What is the difference between a sitemap and a sitemap index?
A sitemap lists individual page URLs directly. A sitemap index is a parent file that points to several child sitemaps instead of listing pages. You use an index once a site grows past the 50,000-URL limit for a single file, splitting your pages across multiple sitemaps that the index ties together.
How many URLs can an XML sitemap contain?
A single XML sitemap file can hold up to 50,000 URLs or 50MB uncompressed, whichever limit you reach first. If your site has more pages than that, split them across multiple sitemap files and reference all of them from one sitemap index file, which Google reads as a group.
Anas Shikh Al Srojieh · Founder, indexly
Writing about SEO, sitemaps, and how to get every page indexed by Google.
Enjoyed this post?
Get our next one delivered to your inbox — no spam, ever.
Ready to get your site fully indexed?
Get started free