What Is an XML Sitemap? Which Sites Need One?

Summarize with AI:

Link copied

A sitemap is a file where you describe the pages, videos and other files on the site, and how they relate. Google reads it to crawl the site more efficiently. Submitting the file does not guarantee that every address in it will be crawled or indexed.

What the file says

In Google's description, a sitemap tells it which pages and files you consider important. It can also carry information about those files. That includes the date the page was last updated, and alternate language versions when you have them. How language versions are written with hreflang is in the hreflang article.

Google has no preference among formats. XML is the most versatile. It can carry images, video, news and language versions. Most content systems already produce RSS and Atom. Those usually carry recent addresses. They can carry video, not images or news. A plain text file lists one address per line and nothing else. This article is about XML, because that is the format that carries the extra information.

If you use a system such as WordPress, Wix or Blogger, the file is probably already being produced. Before writing a new one, open the live address and look.

Which site it helps

If pages are linked properly, Google can usually find most of the site. Proper linking means a path from the menu or from inside a page to every page you consider important. The SEO article treats that as the first condition of crawling. Even so, a sitemap can improve crawling on large, complex sites, or sites with specialized files. Google also writes that in most cases a site will benefit from having one. The two sentences are read together. A benefit is not a requirement.

Cases Google's sitemap overview lists as might need one, and might not.
You might need oneYou might not
The site is large. Making sure every page is linked from at least one other page gets harder. Googlebot may miss some new pages.The site is small. Google's measure is about 500 or fewer pages that you want in search results.
The site is new and has few links from outside. Googlebot finds addresses from links on pages it has already crawled. If no other site links in, pages may not be discovered.Internal linking is complete. Starting from the home page, Googlebot can walk to every important page.
You have many videos, images, or pages you want shown in Google News. A sitemap can carry extra information about those files.You do not have many media or news pages you want shown in search.

Which address goes in

The file lists the addresses you want to see in search results. Google generally shows the canonical address in results. If the same content opens at several addresses, write the one you prefer, not all of them. That preference is a weak canonical signal. It is weaker than a rel="canonical" tag. When you use both, they need to name the same address. Naming different addresses splits the signal. The detail is in the canonical article.

Addresses are complete and absolute. Write https://www.example.com/contact. Do not write /contact. Google will try to crawl the address exactly as it appears in the file. If mobile and desktop have separate addresses, the document recommends listing one version. If you list both, you need to mark which is which.

The order of the addresses does not matter to Google. A file of up to a few dozen URLs can be written by hand. Beyond that, the site itself needs to produce it. The place that produces it is the site and the software. A ticked box in a panel does not mean the live file matches the list in that box.

Illustrative example

A one-page example, made up on example.com. This is not a client file. lastmod is the day of the last significant change on that fictional page. Changing the copyright line does not count as a significant change.

<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://www.example.com/contact</loc> <lastmod>2026-04-03</lastmod> </url> </urlset>

lastmod stays, priority does not

Google ignores changefreq and priority. It uses lastmod when the value is consistent and verifiable. One way it verifies the value is by comparing it with the last modification of the page. A significant change is the main text, the structured data, or the links on the page. Updating the copyright year does not count.

A file that writes today's date on every address every night breaks that condition. If Google compares the date with the page and finds it unreliable, it does not use the field. Leaving the date empty is a more honest file than writing a wrong one.

Size, place and how the file is found

A single file is limited to 50 MB uncompressed or 50,000 addresses. Whichever you hit first, you split the file. You can optionally build a sitemap index and give Google that one index. You can also submit several files. That is useful when you want to watch the performance of each file separately in Search Console.

The file is UTF-8. XML values are entity-escaped. It can sit anywhere on the site. If you did not submit it through Search Console, the file affects only URLs below the directory it lives in. A file at the root can affect the whole site. The document recommends the root for that reason.

Google sees the file in a few ways. The sitemaps report in Search Console shows when the file was read and whether processing raised errors. How to read that report is in the Search Console article. It can also be submitted with the Search Console API. This line can be placed in robots.txt: Sitemap: https://example.com/sitemap.xml. You can write more than one line. No upper limit is stated for the number inside robots.txt. Google sees the line the next time it crawls robots.txt. If you use Atom or RSS, a change can be announced with WebSub.

Submitting is a hint

Submitting is a hint that Google might download the file or crawl the addresses in it. It is not a guarantee. Nor is it a guarantee that every item in the sitemap will be crawled or indexed. The reason an address stays out of the index sits on the page itself. A closed page, a duplicate, or content far from the query is not fixed by writing the address into the file.

On a small brochure site, a missing sitemap is not the first explanation for being absent from search. Look first at whether the page is open and linked from inside the site. On a large or new site, the sitemap lists the addresses the menu does not reach. Both need upkeep. As long as a retired address stays in the file, the list you tell Google you care about and the list that exists on the site diverge.

Sources