What is an XML sitemap?
Search engines find pages mainly by following links. A sitemap complements this: it lists the addresses directly, often together with the date of the last change. The format is defined in the sitemap protocol, which Google, Bing and other search engines support.
The sitemap is a hint, not an instruction. Google decides for itself which of the listed pages it crawls and adds to its index. Our entry on indexing explains how this step works.
An XML sitemap should not be confused with an HTML sitemap: a normal page with links for visitors, like a table of contents.
Do I need an XML sitemap?
Google names three cases in which a sitemap is particularly helpful:
- The website is large, so individual pages can easily end up without links.
- The website is new and has few links from other websites.
- The website has a lot of video and images or appears in Google News.
For small websites with about 500 pages or fewer that are comprehensively linked internally, Google says a sitemap may not be needed. It does no harm, though. Most content management systems and SEO plugins generate one automatically anyway.
Structure of an XML sitemap
The sitemap protocol requires only a few elements:
urlsetencloses the whole list.urlstands for one entry.loccontains the full address including https and the domain.lastmodis optional and gives the date of the last change, for example 2026-10-19.
The fields changefreq and priority are also provided for in the protocol, but according to Google they are ignored. Google only uses the date in lastmod if it is consistently accurate. It should therefore only change when the main content, the structured data or the links of a page change, not for every small detail such as the year in the copyright notice.
A sitemap may contain no more than 50,000 addresses and must not be larger than 50 MB uncompressed. It must be UTF-8 encoded. Larger websites split their addresses across several sitemaps, for example by page type, and combine them in a sitemap index file. This also makes monitoring easier, because Search Console evaluates each sitemap separately.
Which URLs belong in the sitemap?
The sitemap should only contain pages that are meant to appear in search results. That means:
- The page returns the status code 200.
- It is indexable, i.e. not excluded with noindex.
- It is the preferred version, which the canonical tag also points to.
- It is not blocked for search engines in the robots.txt file.
Redirected addresses, error pages, parameter variants and internal search results do not belong in it. If the sitemap contains such addresses, it sends conflicting signals: it says “please index”, while the page itself says something else. One exception is the temporary additional sitemap with the old addresses during a site move, see the next section.
Submitting and monitoring the sitemap
Google finds a sitemap in three ways:
- via the “Sitemaps” report in Google Search Console,
- via the Search Console API,
- via a line in the robots.txt file, such as
Sitemap: https://www.example.co.uk/sitemap.xml. This also works for other search engines.
Google recommends placing the sitemap in the root directory of the domain. If it sits in a subfolder and is not submitted via Search Console, it only applies to the pages in that folder.
In the Sitemaps report, you can see whether Google was able to read the file and how many addresses it found. Compare this number with the page indexing report: if many pages from the sitemap are left out, it is worth looking for the cause. During a relaunch with new addresses, temporarily submit an additional sitemap with the old addresses that now 301 redirect to the new ones. This lets you see in Search Console how indexing shifts to the new addresses. Once the move is complete, remove this sitemap again. Checking the sitemap, robots.txt and canonicals is part of technical SEO.
Does your sitemap contain errors, or is Google only indexing some of your pages? Then get in touch with us or read more about our technical SEO!
