Free to explore: filter winning sites by DR, traffic and niche  ·  Try the live explorer →

XML sitemaps: what they do for SEO

XML code on a developer monitor

Ask what is XML sitemap in SEO and the short answer is a machine-readable list of the URLs you want search engines to know about. The longer answer is about expectations. Sitemaps are routinely treated as something that gets pages indexed, and they are not. They get pages found. What happens after that depends on the page.

That distinction decides what goes in the file. A sitemap stuffed with every URL the CMS can produce is less useful than a short one listing only the pages you would be happy to see in search results.

What is XML sitemap in SEO, and what does the file contain?

The format is defined by the sitemaps.org protocol. Three tags are required: <urlset> wraps the file, <url> wraps each entry, and <loc> holds the address. Everything else is optional.

Here is an XML sitemap example with a single entry:

A sitemap index file listing

The protocol is strict about the file itself: “The file itself must be UTF-8 encoded.” Non-UTF-8 files and unescaped characters in URLs are among the simplest causes of a sitemap that a search engine refuses to read.

The limits, and the optional tags

The protocol sets hard ceilings on size. These are the facts worth keeping to hand:

ElementRequired?What the protocol saysPractical weight
<urlset>, <url>, <loc>YesThe container, the entry and the addressThe whole point of the file
<lastmod>NoLast modification date, in W3C Datetime formatUseful if it is accurate
<changefreq>NoA value from always to neverGoogle has said it ignores it
<priority>NoA value from 0.0 to 1.0Google has said it ignores it
File sizeLimitNo more than 50,000 URLs and 50MB (52,428,800 bytes)Split larger sites into several files
Sitemap indexLimitNo more than 50,000 sitemaps and 50MBEnough for almost any site
A sitemaps report in a webmaster tool

Gzip compression is allowed, but the uncompressed limit still applies, so compressing a file that is over 50MB does not make it valid. Sites that outgrow one file use a sitemap index, which lists the individual sitemaps and is submitted in their place.

The received wisdom says to set priority carefully and tune changefreq per section. Google has said it ignores both. Time spent on them is better spent making <lastmod> honest, because a date that changes on every build, whether or not the content did, teaches crawlers to stop trusting it.

Is sitemap XML important for SEO?

It depends on how easily your pages are found without one. On a small site with clean internal linking, crawlers reach every page by following links, and a sitemap adds little. On a large site, a new site with few external links, or a site with pages buried deep in the architecture, it can be the fastest route for a new URL to be discovered.

A website architecture tree diagram

What it never does is guarantee indexing. A URL in the sitemap still has to be crawlable, return a 200, be its own canonical and be worth indexing. If those conditions fail, listing it changes nothing. Our guide on how to get indexed by Google covers what decides the second half.

Where sitemaps quietly help is diagnosis. Submitting one in Search Console gives you a defined set of URLs to measure against, so the gap between “submitted” and “indexed” becomes visible. That gap is often more informative than the sitemap itself.

The role of an XML sitemap on a large site

On large sites, the sitemap stops being a formality and becomes a statement of intent. Listing only canonical, indexable URLs tells search engines which pages you consider important, and keeps crawling focused on them rather than on parameter variants and thin archives.

Last-modified dates in code

Accurate <lastmod> values matter most here. When a catalogue has many pages and only a few change each day, a trustworthy date lets crawlers pick out what is new. That ties directly to crawl budget, which is only a real constraint on sites large enough to have one.

Splitting sitemaps by type (products, categories, articles) is worth doing even below the size limit. It makes the indexed-versus-submitted figures in Search Console meaningful per section, so a problem with one template shows up instead of being averaged away.

Sitemaps can also carry alternate-language annotations, using xhtml:link entries under each URL. For sites with many language versions this keeps the markup out of every page head and in one place, which our guide to hreflang tags compares with the other two methods. The trade-off is visibility: an error in the sitemap does not show when you view a page’s source, so it needs its own checks.

A large ecommerce catalogue

Common mistakes, and how to submit one

  • Listing URLs that redirect, 404 or are noindexed. Each one is a contradiction: you are asking for a page to be found that you have told search engines not to keep.
  • Listing non-canonical URLs. Parameter versions, paginated duplicates and print views do not belong in the file.
  • Blocking the sitemap’s URLs in robots.txt. A page that cannot be crawled cannot be assessed, whatever the sitemap says.
  • Letting the file go stale. A generated sitemap that updates with the site is better than a hand-made one that does not.

Submit the sitemap, or the sitemap index, in Search Console, and reference it in robots.txt with a Sitemap: line so other crawlers find it too. Our guide to robots.txt for SEO shows where that line goes.

After submission, check the report rather than assuming success. A sitemap that could not be fetched or parsed shows an error status, and a fetched sitemap shows how many URLs were discovered. If that number is far from what you expected, the generator is probably including or dropping a whole template, and that is far easier to fix at source than page by page.

A robots file with a sitemap line

One limitation is worth stating plainly. A sitemap tells you what you submitted, not what search engines think of it. Search Console reports how many URLs were indexed, but its explanations for the rest are broad categories rather than reasons, so a large unindexed share is a prompt to investigate the pages, not proof of a sitemap fault.

The practical test for any URL is simple: would you be glad to see it in search results? If yes, it belongs in the sitemap. If not, leave it out, and make sure nothing else on the site is pointing crawlers at it either.

Frequently asked questions

What is an XML sitemap in SEO?

A machine-readable file listing the URLs you want search engines to discover, optionally with the date each one last changed. It aids discovery but does not guarantee indexing.

How many URLs can one sitemap hold?

The sitemaps.org protocol allows no more than 50,000 URLs and 50MB uncompressed per file. Larger sites split them and list the files in a sitemap index.

Do priority and changefreq matter?

Google has said it ignores both. An accurate lastmod date is more useful than either.

Does a small site need an XML sitemap?

It helps less when internal linking is clean, but it costs little and gives you a submitted-versus-indexed baseline in Search Console.

The takeaway Treat the sitemap as a list of pages you want found, not a lever for indexing. Keep it to canonical, indexable URLs, keep lastmod honest and ignore priority and changefreq.