Back to SEO Glossary

What is an XML Sitemap?

An XML sitemap is a machine-readable XML file that lists a website’s important URLs, with optional details like each page’s last-modified date. Search engines read it to discover and crawl pages they might otherwise miss. It follows the sitemaps.org protocol and is the format most CMSs and SEO plugins generate automatically.

More About XML Sitemaps

Most websites benefit from an XML sitemap because it helps Google find your most important web pages. Finding isn’t the same as appearing, though. The file helps search engines discover the URLs you list, but it guarantees neither crawling nor indexing: Google decides both on its own, and only pages it indexes are eligible to appear in search results. For instance, a page with no internal link pointing to it is difficult for crawlers to reach. An XML sitemap hands Google that URL directly, along with when the page last changed.

An XML sitemap is especially useful for large websites with deep archives and rich media, and for new websites that few external links point to yet. Google’s sitemap documentation draws the line at about 500 pages: below that, if every page can be reached by following links from your homepage, you probably don’t need one. For when a site needs a sitemap at all, and the other formats search engines accept, see our sitemap entry.

Inside an XML sitemap file

An XML sitemap is a plain text file, and the format is strict on only a few points. The file must be UTF-8 encoded, it opens with a <urlset> tag that declares the protocol namespace, and each page gets its own <url> entry. Here’s a complete one-entry sitemap, based on the sample in the sitemaps.org protocol:

<?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-08-01</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.8</priority>
  </url>
</urlset>

  • <urlset> (required) wraps the file and names the protocol standard in use.
  • <url> (required) is the parent tag for each page entry.
  • <loc> (required) is the page’s full URL, protocol included, under 2,048 characters.
  • <lastmod> (optional) is the date the page last changed, in W3C Datetime format such as 2026-08-01.
  • <changefreq> (optional) says how often the page is likely to change, from always down to never.
  • <priority> (optional) ranks the page against your other pages, from 0.0 to 1.0; the default is 0.5.

Treat the last two as hints, not commands. The protocol itself warns that priority “is not likely to influence the position of your URLs” in search results; it only helps crawlers choose among pages on your own site.

Size limits and file location

One sitemap file can hold at most 50,000 URLs and must be no larger than 50MB (52,428,800 bytes). Bigger sites split their URLs across several sitemap files and reference them from a sitemap index file, which can itself list up to 50,000 sitemaps and has the same 50MB cap. Gzip compression is allowed if the file gets heavy.

Put the file at your site root, such as example.com/sitemap.xml; the protocol strongly recommends it. Location sets scope: a sitemap in a subfolder can only describe URLs in that folder and below, so the root covers your whole site.

XML sitemaps vs. HTML sitemaps

An HTML sitemap is a regular web page that lists links to your site’s pages so human visitors can browse its structure. It’s navigation, not a crawler file: search engines treat it like any other page, not as a sitemap format they accept for submission. The decision rule is simple. Use an XML sitemap to hand crawlers your URLs and their metadata; add an HTML sitemap when visitors need a browsable overview of a large site. The two do different jobs, and one doesn’t replace the other, so plenty of sites use both.

Image, video, and news extensions

XML’s advantage over the plain text, RSS, and Atom formats search engines also accept is that it’s extensible. Google’s format comparison calls XML sitemaps “the most versatile” of the formats: an entry can carry extra data about the images, video, and news content on a page, such as a video’s running time or an article’s publication date, plus the localized versions of a page in other languages. If image, video, or news search matters to your site, XML entries are how you describe that content to Google.

Common XML sitemap mistakes

A sitemap should list the pages you want indexed: for each one, its preferred canonical URL, returning a successful response and open to crawlers. Most sitemap problems live in the URLs, not the XML around them. The usual suspects:

  • Redirects and error pages: a URL that redirects or returns a 4xx or 5xx error gives Google nothing to index at the listed address. List each page’s final, working URL instead.
  • Noindex pages: a noindex tag tells search engines to keep a page out of results, so a sitemap entry for it spends crawl time on a page that can’t appear. Remove the URL from the file, or remove the tag if the page belongs in search.
  • Duplicate and noncanonical versions: list each page once, at its preferred URL. Including both the http and https versions may leave your site incompletely crawled, and every extra variant makes Google guess which one you want indexed.
  • Blocked URLs: if robots.txt blocks a URL, crawlers can’t read the page, so the sitemap entry becomes an error in your reports rather than a result in search.
  • Wrong host: every URL must live on the same host as the sitemap file itself.
  • Partial URLs: each one must be fully specified, protocol included. https://www.example.com/ is valid; www.example.com isn’t.
  • Session IDs: strip them from URLs, or crawlers waste time on redundant copies of the same page.
  • Stale lastmod: set it to the date the page actually changed, never the date the sitemap was generated.

If something looks off, validate the file first; the protocol publishes an XML schema for exactly that. Then check the errors Google Search Console reports for your sitemap after you submit it, and fix the URLs it flags.

Creating and submitting an XML sitemap

You’ll rarely write this file by hand. Most CMSs generate an XML sitemap automatically; WordPress has published one at yoursite.com/wp-sitemap.xml since version 5.5 in 2020, and SEO plugins and standalone generators cover the rest. Once the file exists, tell search engines where it lives: submit its URL in Google Search Console, or add a Sitemap: line to your robots.txt file so that Google, Bing, and any other crawler that supports the directive can find it without an account. Set it up once, and your CMS keeps the file current.

Frequently Asked Questions

No. The protocol defines its optional fields as hints, and listing a URL doesn’t force Google to crawl or index it. If an important page stays out of the index, fix the page; our sitemap entry explains why a sitemap is only a hint.
No. Every URL must live on the same host as the sitemap file, so a sitemap at www.example.com/sitemap.xml can’t list pages on store.example.com. Publish a separate sitemap on each subdomain instead.
They do different jobs, so most sites use both. A robots.txt file tells crawlers what to stay out of; a sitemap lists what you want found. They meet in one place: a Sitemap: line in robots.txt is a standard way to publish your sitemap’s location.
No. The name is a convention, not a rule. The protocol recommends placing the file at your site root, like example.com/sitemap.xml, but WordPress names its own wp-sitemap.xml. Whatever the name, submit the exact URL in Google Search Console or list it in robots.txt.
Special Offer

Professional SEO Services

Our Pro Services team will help you rank higher and get found online. Let us take the guesswork out of growing your website traffic with SEO.

SEO Services