Skip to content

XML sitemap

Also called sitemap.xml, sitemap

What is an XML sitemap?

An XML sitemap is a file, usually at /sitemap.xml, that lists the URLs on a site you want search engines to crawl and index. Each entry gives the page’s full URL and, optionally, when it last changed. It helps crawlers find pages faster, but it does not guarantee that they will be crawled or indexed.

A central folder connected by lines to multiple document files and a large rolled-up scroll, illustrating an XML sitemap.

The format comes from the sitemaps.org protocol, which Google, Bing and other engines share. A single sitemap can hold up to 50,000 URLs or 50 MB uncompressed. Bigger sites split their URLs across several sitemaps and list those in a sitemap index file. Sitemaps can be gzipped to save bandwidth.

Each <url> entry has a required <loc> with an absolute URL. The optional <lastmod> gives the date of the last meaningful change. The protocol also defines <priority> and <changefreq>, but Google ignores both. Google uses <lastmod> only when it is consistently and verifiably accurate, so it should change when the content, structured data or links change, not every time the page is rebuilt.

There are also extensions for images, videos and news, plus the option to list hreflang alternates inside the sitemap rather than in each page’s HTML.

Why XML sitemap matters for SEO

Search engines mainly discover pages by following links. A sitemap is a second route in. It matters most for large sites, new sites with few backlinks, sites that publish often, and pages that are poorly linked internally, such as deep product pages.

A sitemap is also a statement of intent. It tells Google which URL you consider the canonical version of each page. Listing redirected, noindexed, broken or non-canonical URLs sends mixed signals and makes your sitemap less trustworthy, so keep it to indexable 200-status pages only.

Once you submit it, the Sitemaps report and page indexing report in Google Search Console show how many listed URLs are indexed, which is one of the quickest ways to spot indexing problems.

How to create an XML sitemap

  1. Generate it automatically. Most CMSs and frameworks can build a sitemap from your content, which keeps it in step as pages are added and removed. Hand-written sitemaps go stale.
  2. Include only canonical, indexable URLs that return 200. Leave out redirects, 404s, noindexed pages, URLs blocked by robots.txt and parameter variants.
  3. Use absolute URLs on the same protocol and host as the site: https://www.example.com/page, not /page.
  4. Set <lastmod> from the real last-modified date of the content, in W3C date format (2026-10-01 or 2026-10-01T09:30:00+00:00). Do not set every URL to today’s date.
  5. Split past 50,000 URLs or 50 MB. Group URLs by type (products, categories, articles) so you can see indexing rates per section, and link each sitemap from a sitemap index.
  6. Submit the sitemap or sitemap index in Search Console and Bing Webmaster Tools, and add a Sitemap: line to robots.txt so every crawler can find it.
  7. Check the Sitemaps report after each big change for fetch errors and a falling indexed count.

XML sitemap example

sitemap.xml
<?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>2026-10-01</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/guides/robots-txt</loc>
    <lastmod>2026-09-14</lastmod>
  </url>
</urlset>

XML sitemap FAQ

Do I need an XML sitemap?

Small, well-linked sites can be crawled fine without one, but a sitemap costs little and helps Google and Bing find new and updated pages. Large sites, new sites and sites with deep or poorly linked pages benefit most.

How many URLs can a sitemap have?

Up to 50,000 URLs or 50 MB uncompressed per sitemap file. Beyond that, split the URLs into several sitemaps and list them in a sitemap index.

Does Google use priority and changefreq?

No. Google ignores <priority> and <changefreq>. It uses <lastmod> only when the dates are consistently accurate.

Can I still ping Google with my sitemap?

No. Google retired the sitemap ping endpoint in 2023. Submit the sitemap in Search Console or reference it in robots.txt; Google rechecks it on its own. For Bing and some other engines, IndexNow is the way to notify changes.

Related SEO terms

Back to the SEO glossary

Put the terms to work

Every term here is something OpenSEO measures. It is open source: start online in a minute, or run it on your own server.