What it checks
- Well-formed XML. One unescaped
&or a stray character makes the whole file unreadable to search engines, not just one entry. The parser's message is shown, with a hint when the cause is an ampersand. - Root element and namespace. A sitemap is a
<urlset>; an index of sitemaps is a<sitemapindex>. Both must declarexmlns="http://www.sitemaps.org/schemas/sitemap/0.9". - Every
<loc>: present, an absolutehttporhttpsURL, at most 2,048 characters, no spaces, no#fragment, not duplicated. <lastmod>in W3C Datetime format (2025-06-01or2025-06-01T09:30:00+00:00), real calendar dates, and not in the future.<changefreq>and<priority>have legal values (Google ignores both, so the checker only notes them).- Limits: 50,000 URLs and 50 MB uncompressed per file.
- Hosts: all URLs should be on the host the sitemap is served from.
httpvshttpsandwwwvs bare domain count as different hosts. - Extensions for images, video, news and hreflang (
xhtml:link) are recognised.
A minimal valid sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2025-06-01</lastmod>
</url>
<url>
<loc>https://www.example.com/products?id=7&color=red</loc>
</url>
</urlset>
Only <loc> is required. Note the &: inside XML, the five characters & < > " ' must be written as entities. Most sitemap errors in the wild are this one.
Sitemap indexes
When a site has more than 50,000 URLs, or you want separate files per section, list the sitemaps in an index:
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://www.example.com/sitemap-products-1.xml.gz</loc></sitemap>
<sitemap><loc>https://www.example.com/sitemap-blog.xml</loc></sitemap>
</sitemapindex>
An index may list up to 50,000 sitemaps, but it cannot list other indexes. Sitemaps may be gzip-compressed; the 50 MB limit applies to the uncompressed size.
What matters to Google, and what does not
- lastmod is used, but only if it is consistently accurate. Set it to the date the page's main content last changed, not the date the sitemap was generated. A sitemap where every URL has today's date teaches Google to ignore the field.
- priority and changefreq are ignored by Google. Bing has said the same about priority.
- Listing a URL does not guarantee indexing. A sitemap is a hint about which URLs exist and which are canonical. List only canonical, indexable URLs that return 200: no redirects, no 404s, no pages with
noindex, no parameter duplicates. - Tell search engines where it is with a
Sitemap:line in robots.txt and by submitting it in Google Search Console and Bing Webmaster Tools.
Common errors and fixes
| Error | Fix |
|---|---|
| "EntityRef: expecting ';'" or similar parser error | Replace & in URLs with &, or let your generator escape output. |
| Missing or wrong namespace | Use exactly http://www.sitemaps.org/schemas/sitemap/0.9 (http, not https). |
Relative URLs such as /about | Write the full URL including protocol and host. |
lastmod like 31/12/2025 or 2025-12-31 10:00 | Use 2025-12-31 or 2025-12-31T10:00:00+00:00; a time needs a time zone. |
Text before <?xml (a blank line, a BOM in the wrong place, a PHP warning) | The XML declaration must be the very first thing in the file. |