XML Sitemap

An XML sitemap is a file that lists the pages on your website so search engines can find them all. That is its whole job. It does not change your rankings, it does not hide anything, and it is not complicated. This page shows you what the file looks like inside and which rules actually matter.

What the file looks like

Here is a complete, working sitemap with two pages in it:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2026-06-15</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/about</loc>
  </url>
</urlset>

That really is the whole format. One wrapper, one entry per page, one address per entry. Google, Yahoo, and Microsoft agreed on this standard back in 2006 and it has barely changed since, which is why every crawler out there can read it.

The tags in plain English

  • urlset wraps the file and names the standard it follows. Required, and always the same.
  • url wraps one page entry. You need one per page.
  • loc holds the page address. It must be the full address, https:// and all, not a shortcut like /about.
  • lastmod is the date the page last changed. Optional, but the one optional tag worth using. Google says it pays attention to lastmod when the dates look honest, and ignores it on sites that stamp every page with today’s date.
  • changefreq and priority show up in older tutorials and older tools. Google has said for years that it ignores both, and Bing has said much the same. Including them does no harm, but it does no good either.

The rules that matter

  • One sitemap file can hold up to 50,000 addresses and weigh up to 50 MB uncompressed. Bigger sites use several files plus a sitemap index file, which is simply a sitemap that lists other sitemaps.
  • Every address must be absolute. https://www.example.com/page works; /page does not.
  • Stick to one version of your site. If your pages live at https://www.example.com, do not list http:// addresses or drop the www.
  • The file is UTF-8, and a few characters (like &) must be written as XML entities. Any decent tool handles that for you.
  • You can compress the file as sitemap.xml.gz. Search engines read it fine.

Why a sitemap sometimes points to more sitemaps

Follow the chain on many sites and it feels like a runaround. robots.txt points to a sitemap file. You open that file, and instead of pages you find links to more sitemap files. Those finally list the pages. Why the extra hop?

The layer in the middle is a sitemap index file. It exists because one sitemap file tops out at 50,000 addresses, so bigger sites split their pages across several files, and the index is the one address that covers them all. Search engines only want one address from you; the index lets that address stay the same while the files behind it come and go.

So why does your 12-page site have one too? WordPress and its SEO plugins build an index for everyone, big or small, usually one file per content type: one for posts, one for pages, and so on. It looks like overkill on a small site, and honestly it is, but it is harmless. Crawlers read the index and hop through to the real files without breaking stride. If your sitemap points at more sitemaps, nothing is wrong. That is just the standard’s way of scaling.

Sitemaps that are not XML

The XML format is the standard, but search engines accept two other shapes:

  • A plain text file: one full address per line, nothing else, saved as something like sitemap.txt. It carries no dates, but it is completely valid.
  • RSS or Atom feeds. Blogs sometimes submit these, but a feed only lists recent posts, so it is a supplement, not a substitute.

There are also XML extensions for images, video, and news publishers. Most sites never need them, and if you do, you will know.

Mistakes we see all the time

  • Listing pages that redirect, no longer exist, or are marked noindex. Search engines treat your sitemap as a list of pages you stand behind. Fill it with junk and they trust the file less.
  • Relative addresses instead of full ones.
  • Mixing http and https, or www and non-www, in one file.
  • Stamping every page with today’s date as lastmod. That teaches Google to ignore your dates.
  • Building the file once and forgetting it. A sitemap does not update itself. When your pages change, rebuild it.

Where the file goes

Put sitemap.xml in the same folder as your home page, then tell the search engines where it is. You can submit it in Google Search Console and Bing Webmaster Tools, or add one line to your robots.txt file and let every crawler find it on its own. Our free sitemap generator page walks through all three, step by step.

Need to build the file?

That same free sitemap generator crawls your site and writes the XML for you, up to 600 pages, no signup. And if your site runs on WordPress, look before you build: WordPress and its SEO plugins usually publish a sitemap automatically at /sitemap.xml or /wp-sitemap.xml.

And when a sitemap misbehaves (the crawl stops at the first page, Google rejects the file, strange characters show up), our sitemap generator troubleshooting guide covers the fixes.

© 2002-2026 AuditMyPC.com