XML Sitemap

What an XML sitemap is, its anatomy, the ignored tags (priority/changefreq), accurate lastmod, the 50,000/50MB limits, hreflang in sitemaps, and how to submit one.

First published: Jun 22, 2026 · Last updated: Jul 18, 2026 · Advanced
demand #3 in Discovery#12 in How Search Works#53 in Technical SEO#73 on the site
1 evidence signal on this page

An XML sitemap is a UTF-8 file listing the canonical, indexable URLs you want search engines to know about — each in a <url> block with a required <loc> and an optional <lastmod>. It helps engines discover URLs but doesn't guarantee indexing; its real payoff is the submitted-vs-indexed diagnostic in Search Console. Google ignores <priority> and <changefreq>, and uses <lastmod> only when it's verifiably accurate (significant updates, not a blanket 'today'). One sitemap caps at 50,000 URLs or 50MB uncompressed — past that you split files and reference them from a sitemap index. Include only canonical, indexable, 200-status URLs; leaving a URL out of the sitemap is not the same as noindexing it. Sitemaps are also the easiest place to manage hreflang at scale. Reference it in robots.txt and submit it in Search Console and Bing Webmaster Tools.

TL;DR — An XML sitemap is a UTF-8 file of canonical, indexable <loc> URLs, each optionally carrying a <lastmod>. It aids discovery, not indexing — the payoff is the submitted-vs-indexed signal in Search Console. Google ignores <priority> and <changefreq> and uses <lastmod> only when it’s verifiably accurate (significant updates, never a blanket “today”). One file caps at 50,000 URLs or 50MB uncompressed — past that, split and use a sitemap index. Include only 200, canonical, indexable URLs; excluding a URL is not the same as noindexing it. XML isn’t the only accepted format (RSS/Atom/txt work too), and sitemaps are the easiest place to manage hreflang at scale — though those annotations go live on a lag, not instantly. Reference it in robots.txt and submit it in Search Console + Bing Webmaster Tools.

Evidence for this claim The XML sitemap protocol lists canonical URL locations and optional metadata, with limits of 50,000 URLs and 50 MB uncompressed per sitemap. Scope: Sitemaps protocol and current Google-supported limits. Confidence: high · Verified: Sitemaps XML format Evidence for this claim Google treats sitemaps as discovery hints rather than guarantees and supports submission through Search Console or robots.txt references. Scope: Current Google sitemap behavior and submission methods. Confidence: high · Verified: Google Search Central: Build and submit a sitemap

What an XML sitemap actually is

An XML sitemap is a file, written to the sitemaps.org 0.9 protocol, that lists the URLs on your site you want engines to know about. Google’s own definition: “A sitemap is a file where you provide information about the pages, videos, and other files on your site, and the relationships between them.” It’s a discovery aid and a coverage diagnostic — explicitly not a guarantee: “A sitemap helps search engines discover URLs on your site, but it doesn’t guarantee that all the items in your sitemap will be crawled and indexed.”

That framing matters, because it’s where a lot of effort gets misspent. The sitemap isn’t a ranking lever and it isn’t an indexing command. Here’s an annotated minimal example:

<?xml version="1.0" encoding="UTF-8"?>            <!-- XML declaration; UTF-8 -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">  <!-- root + namespace -->
  <url>                                           <!-- one entry per page -->
    <loc>https://www.example.com/foo.html</loc>   <!-- required: absolute URL -->
    <lastmod>2026-06-04</lastmod>                 <!-- optional: last significant change -->
  </url>
</urlset>

Anatomy

  • The XML declaration<?xml version="1.0" encoding="UTF-8"?>. Google is unambiguous here: “The sitemap file must be UTF-8 encoded.” Get the encoding wrong and special characters break.
  • <urlset> + namespace — the root element, with xmlns="http://www.sitemaps.org/schemas/sitemap/0.9". The namespace is what tells the parser this is a sitemap; the wrong or missing namespace is a common Search Console error.
  • <url> — one block per page.
  • <loc> — required. “Use fully-qualified, absolute URLs in your sitemaps” — not relative paths, and under ~2,048 characters. All values must be entity-escaped: & becomes &amp;, ' becomes &apos;, " becomes &quot;, > becomes &gt;, and a literal less-than becomes &lt;.
  • <lastmod> — optional; the date the page last significantly changed (more on the honesty rule below).
Evidence for this claim Each loc must be a fully qualified absolute URL and XML special characters must be entity escaped. Scope: XML/HTTP sitemap generation, hosting and submission Confidence: high · Verified: Build and submit a sitemap

The ignored-tags truth

This is the single most out-of-date thing in most sitemap tutorials. Two legacy tags — <priority> and <changefreq> — are ignored by Google. Gary Illyes called priority “essentially a bag of noise,” and John Mueller has said priority and change frequency “doesn’t really play that much of a role with Sitemaps anymore.” Bing has confirmed the same: changefreq and priority no longer affect its crawling or ranking. You can leave them in (they do no harm) or strip them out — they simply don’t do anything.

<lastmod> is different — do not lump it in with the ignored tags. Google does use <lastmod>, but only when it trusts it, and that trust is roughly binary: either Google believes your dates or it doesn’t. The rule is that the date should reflect a significant change — “an update to the main content, the structured data, or links on the page is generally considered significant, however an update to the copyright date is not.” The failure mode I see constantly is stamping every URL with today’s date on every build. That’s self-defeating: Mueller has called it “just lazy,” noting it’s trivial for engines to recognize and only makes it harder for them to spot genuinely updated pages. Lie often enough and, in Google’s words, “eventually we’re not going to believe you anymore.” Bing leans even harder on <lastmod> as a freshness signal than Google does — so an accurate date helps you on both engines, and a fake one hurts you on both.

Placement, naming, encoding, and compression

  • Placement/naming. There’s no required filename, but /sitemap.xml at the root is the convention. By default a sitemap only affects URLs at or below its own path, so keep it high enough to cover everything it lists. The one exception: you can host a sitemap for a different site if you’ve verified ownership of that site and its robots.txt points back to the sitemap’s actual location — Google calls this cross-submission, and it’s the mechanism behind a sitemap index aggregating sitemaps hosted elsewhere.
  • Encoding. UTF-8, always.
  • Compression. You’re allowed to gzip a sitemap (serve it as .xml.gz), which is worth doing on large files. Important nuance: the 50MB cap is measured uncompressed — gzip saves bandwidth, not headroom against the size limit.

Limits → split + sitemap index

A single sitemap is capped at 50,000 URLs or 50MB uncompressed, whichever comes first. Google states it directly: “All formats limit a single sitemap to 50MB (uncompressed) or 50,000 URLs.” When you blow past either limit, you split the list across multiple sitemap files and reference them all from a sitemap index — a sitemap of sitemaps. That’s its own sibling topic; the short version is that you submit the index, and one index can point at up to 50,000 child sitemaps, so you’ll never actually run out of capacity.

Which URLs to include — and “exclude ≠ noindex”

Include only URLs that are indexable, canonical, and return 200. That means no 3xx redirects, no non-canonical duplicates, no noindex pages, no robots-blocked URLs. A clean sitemap of exactly your indexable set is what makes the Search Console submitted-vs-indexed comparison meaningful — pollute it with junk and you’ve thrown away the diagnostic.

Now the mechanical point people get wrong: excluding a URL from your sitemap does not deindex it. The sitemap is an advertisement, not a gate. Removing a URL’s entry just stops you advertising that page; if Google already knows about it (via links, history, or another source) it stays in the index. The only mechanisms that actually remove a page are a noindex directive (with crawling allowed so Google can see it), a 404/410, or the removals tool. So “take it out of the sitemap” is never the right answer to “how do I deindex this.”

Accepted sitemap file formats

XML isn’t the only format Google accepts — worth knowing so you don’t assume you’re stuck hand-writing XML. Google calls XML “the most versatile of the sitemap formats,” but it also reads:

  • RSS 2.0 / Atom feeds — handy because many CMSs already publish one; they carry page URLs only.
  • mRSS — a media RSS feed, used for video.
  • Plain text (.txt) — literally one URL per line, web-page URLs only, UTF-8.

XML is still the right default because it’s the only format that supports the extensions (lastmod metadata, image, video, and hreflang annotations). The others are URL-only.

hreflang in sitemaps

If you run a multilingual or multi-regional site, the sitemap is usually the easiest place to manage hreflang — you maintain the whole language cluster in one file instead of injecting return-tags into every page template. (It’s one of the three valid places hreflang can live; the <head> and HTTP headers are the others.)

How it’s implemented. Each <url> gets xhtml:link rel="alternate" children, one per language/region version, and you declare the namespace xmlns:xhtml="http://www.w3.org/1999/xhtml" on <urlset>:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://www.example.com/english/page.html</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/english/page.html"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/english/page.html"/>
  </url>
  <!-- each alternate URL repeats the FULL set, including itself (return tags) -->
</urlset>

The return-tag rule. This is the part that bites people. Every <url> element must list every alternate version of the page — including itself. Google: “Each <url> element must have a child element <xhtml:link rel="alternate" hreflang="[supported_language-code]"> that lists every alternate version of the page, including itself.” And it has to be bidirectional: “If page X links to page Y, page Y must link back to page X. If this is not the case for all pages that use hreflang annotations, those annotations may be ignored or not interpreted correctly.” Add an x-default entry for the unmatched-language fallback. A single broken or missing return-tag can invalidate the whole set.

The cap counts <loc> URLs only. A relief for big international sites: the 50,000-URL limit counts only the <loc> page URLs, not the hreflang alternates. So a sitemap with 50,000 pages, each with ten language alternates, still fits — it’s the location URLs that count, not the alternative URLs.

When it actually goes live — budget days, not minutes. Here’s the expectation to set, and it’s mechanism rather than a quotable line. Google parses your sitemap hreflang when it re-fetches the sitemap, but the annotations only take effect once all the URLs in the set have been (re)crawled and the return-tags reconciled against each other. That means there’s a real lag between publishing the hreflang and the alternates being honored, and one slow-to-recrawl or broken URL in the set can hold the rest up. Don’t expect it to flip on the moment you submit — plan for it to settle over days.

Reference it and submit it

  • robots.txt — add a Sitemap: line with the full absolute URL. This also lets engines auto-discover it.
  • Google Search Console — the Sitemaps report (or the Search Console API) is the primary submission method; it’s also where you read the submitted-vs-indexed diagnostic.
  • Bing Webmaster Tools — submit there too; Bing fetches it quickly and rechecks regularly.

One automation note from how I think about this: a sitemap should be generated automatically from the pages you actually have, so it stays current. A hand-built sitemap rots the moment your site changes. The siblings to this page — the sitemaps overview, the sitemap index for large sites, and the image sitemap and video sitemap extensions — cover the rest of the family, and the broader discovery topic ties sitemaps to the other ways engines find your URLs.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin an expert quote first.