An XML sitemap is a file that lists the addresses of the pages on a website that you want search engines to know about. It is written for crawlers rather than people, in a simple, strict format, and it usually lives at an address such as /sitemap.xml. Most site builders create one automatically, which is why many owners have one without ever having seen it.
This post explains what the file contains, what each line means, the rules Google applies to it and when it actually helps.
What a sitemap looks like
Here is a complete sitemap for a small site with three pages:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
</url>
<url>
<loc>https://www.example.com/services/boiler-repair/</loc>
<lastmod>2026-11-02</lastmod>
</url>
<url>
<loc>https://www.example.com/contact/</loc>
</url>
</urlset>
The first line declares the file as XML in UTF-8. The urlset element wraps the whole list and names the sitemap format. Each url element holds one page, and inside it, loc gives the page’s full address. The optional lastmod gives the date the page last changed significantly.
What the elements mean
| Element | Required? | What it holds |
|---|---|---|
| urlset | Yes | The whole list, with the sitemap namespace |
| url | Yes, one per page | One entry |
| loc | Yes | The page’s full, absolute address |
| lastmod | Optional | The date of the last significant change |
| changefreq | Optional | How often the page changes; Google ignores it |
| priority | Optional | A relative importance; Google ignores it |
Google’s guide to building sitemaps states that it ignores the priority and changefreq values, and uses lastmod when it is consistently and verifiably accurate. In practice, that means leaving the two ignored elements out and including lastmod only when it reflects real changes to the content, not every time a template or a footer changes.
The rules Google applies
Google’s guide sets a short list of requirements:
- Absolute addresses. Every loc must be a fully-qualified address, such as
https://www.example.com/page/, never a relative path like /page/. - UTF-8 and escaping. The file must be UTF-8 encoded, and special characters must be escaped; an ampersand in an address is written as & inside the XML.
- Size limits. A single sitemap can hold at most 50,000 addresses or 50 MB uncompressed. Larger sites split the list across several files and list those in a sitemap index.
The XML sitemap generator builds a valid file from a list of addresses to these rules, rejecting relative addresses, removing duplicates, escaping special characters and warning about mixed hosts.
What belongs in it
A sitemap should list the canonical address of every page you want to appear in search, exactly as you want it shown. It should leave out:
- addresses that redirect;
- pages marked noindex;
- duplicate versions of pages, such as with tracking parameters;
- error pages and empty search or tag pages;
- pages blocked in robots.txt.
A sitemap that lists all of these sends mixed signals: it asks search engines to find pages that the site then tells them to ignore.
Does a small site need one?
Not strictly. Google can discover pages by following links, and a small site where every page is linked from the menu or from other pages will usually be crawled fully without a sitemap. But a sitemap costs almost nothing and helps in several situations:
- New sites, with few links from elsewhere.
- Pages with few internal links, such as old articles deep in an archive.
- Sites that change often, where new pages should be found quickly.
- Checking coverage, because a submitted sitemap lets Search Console report how many of your listed pages are indexed.
What a sitemap does not do is guarantee that every listed page is crawled or indexed. It is a list of suggestions, and Google still decides what to index based on the pages themselves.
How search engines find it
There are two ways to point crawlers to a sitemap. One is to submit it in Search Console, which also gives you a report on what Google found. The other is a line in robots.txt with the sitemap’s full address, which any crawler that reads robots.txt can use:
Sitemap: https://www.example.com/sitemap.xml
The robots.txt generator adds that line for you. Doing both is common. The steps for submitting and reading the report are in how to submit a sitemap to Google.
When one sitemap is not enough
A site with more than 50,000 addresses, or one that wants separate lists for products, categories and articles, uses a sitemap index: a small file that lists other sitemaps rather than pages. Submit the index, and search engines read each sitemap it lists. Many platforms produce one automatically, often at /sitemap_index.xml or /sitemap-index.xml.
HTML sitemaps are something else
An HTML sitemap is an ordinary page that lists links to a site’s main sections, for people to browse. It can be useful on a large site, but it is a different thing from the XML file. The XML sitemap is for crawlers; nobody needs to see it, and it does not need to be linked from the menu.
Keeping it accurate
A sitemap that lists deleted pages or misses new ones does less than it could. If your platform generates it, check once that it excludes noindex pages, redirects and test pages. If you maintain it by hand, rebuild it whenever pages are added, removed or moved. Clean, permanent addresses make that easier, and the URL slug generator helps keep them short and readable.
Sitemaps for images and video
The standard format lists pages. Extensions to the format can also list the images and videos on those pages, which can help them be found in image and video search, particularly when they are loaded in ways a crawler might miss. For most small sites, the pages’ own HTML is enough, and a plain page sitemap does the job. The extensions are worth adding when the images or videos themselves are what people search for, such as a photographer’s portfolio or a library of product videos.
Where the file should live
A sitemap can only list addresses on the host where it is published, or below the folder it sits in, unless the site is set up otherwise in Search Console. The simplest arrangement is a sitemap at the root of the site, listing every page on that host. A site with several hosts, such as a shop on a subdomain, normally needs a sitemap for each.
Generated versus hand-made sitemaps
A sitemap generated by your platform updates itself as pages are added and removed, which is its main advantage. The disadvantage is that it may include pages you never meant to publish: tag archives, author pages, test pages or attachment pages. A sitemap made by hand lists exactly what you choose, but goes out of date unless someone rebuilds it. For most small sites, the generated one is the better choice, checked once for unwanted pages and adjusted through the platform’s settings.
Reading the Search Console report
Once a sitemap is submitted, Search Console shows when Google last read it and how many addresses it found. That number is how many were in the file, not how many are indexed. To see what happened to the listed pages, use the page indexing report filtered to the sitemap. It separates indexed pages from those that were found but not indexed, with a reason for each group, which makes the sitemap a useful tool for checking coverage as well as for discovery.
Common sitemap problems
- Relative addresses instead of full ones.
- The wrong host or protocol, such as http addresses on an https site.
- Redirects and noindex pages listed, sending mixed signals.
- An HTML page or an error returned at the sitemap’s address instead of XML.
- A robots.txt rule blocking the sitemap itself.
Compressed sitemaps
Sitemaps can be compressed with gzip, with addresses ending in .xml.gz, which makes large files faster to download. The size limit applies to the uncompressed file, so compression helps with transfer rather than with how many addresses one file may hold. For a small site, an ordinary uncompressed sitemap is simpler, easier to open and check, and entirely sufficient.
A quick check of any sitemap
- Open it in a browser. It should show XML, not a web page or an error.
- Check a few loc values are complete addresses on the right host and protocol.
- Make sure none of the listed pages redirect or carry noindex.
- Confirm it is under 50,000 addresses, or split under an index.
- Check robots.txt points to it and does not block it.
Sources, read November 14, 2026:
- Google Search Central, Build and submit a sitemap: absolute URLs, UTF-8 and entity escaping, the 50,000-URL and 50 MB limits, ignored priority and changefreq, lastmod when accurate, and submission through Search Console or robots.txt.