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#22 in How Search Works#125 in Technical SEO#168 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 sitemapA sitemap is a file that lists the pages, images, videos, and other files on your site so search engines can discover them. It helps discovery, but submitting a sitemap doesn't guarantee crawling or indexing. is a UTF-8 file of canonical, indexable <loc> URLs, each optionally carrying a <lastmod>. It aids discovery, not indexingStoring a crawled page in the search index so it can appear in results. Crawled is not the same as indexed — Google selects what to keep, and indexing isn't guaranteed. — the payoff is the submitted-vs-indexed signal in Search ConsoleA free Google service that reports how a site performs in Google Search and surfaces problems with how Google crawls, indexes, and serves it. It's first-party data straight from Google — but you don't need it to appear in results.. 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 sitemapA sitemap is a file that lists the pages, images, videos, and other files on your site so search engines can discover them. It helps discovery, but submitting a sitemap doesn't guarantee crawling or indexing. index. Include only 200, canonical, indexable URLs; excluding a URL is not the same as noindexing it. XML isn’t the only accepted format (RSSAn RSS or Atom feed is an XML file listing a site's most recently published or updated URLs. Search engines accept it as a sitemap-style discovery signal for fresh content — not a replacement for a full XML sitemap./Atom/txt work too), and sitemaps are the easiest place to manage hreflangHreflang is an annotation (in HTML, HTTP headers, or XML sitemaps) that tells search engines which language and optional region a page targets, and which alternate versions exist. It only works when every page in the cluster references all the others. at scale — though those annotations go live on a lag, not instantly. Reference it in robots.txt and submit it in Search ConsoleGoogle's free tool for monitoring crawling, indexing, and search performance. + Bing Webmaster ToolsMicrosoft's free portal for monitoring and improving how a site appears in Bing search — the peer to Google Search Console, plus IndexNow instant indexing, richer backlink data, and keyword volumes. Because Bing's index also feeds Microsoft Copilot, it doubles as a window into AI-search visibility..

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 sitemapAn XML sitemap is a UTF-8 file listing the canonical URLs on your site (with optional lastmod) so search engines can discover and prioritize them. It's a discovery and diagnostic aid, not a guarantee of indexing — and Google ignores its priority and changefreq tags. 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 indexingStoring a crawled page in the search index so it can appear in results. Crawled is not the same as indexed — Google selects what to keep, and indexing isn't guaranteed. 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).

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: changefreqSitemap priority is the optional <priority> tag (0.0–1.0, default 0.5) in the sitemaps.org XML protocol meant to rank a URL's importance relative to others on the same site. Google ignores it entirely — as does Bing — and it was never a ranking factor even by the spec's own admission. and priority no longer affect its crawlingCrawling is how search engines use automated bots (like Googlebot and Bingbot) to discover URLs and download pages. A page has to be crawlable to be indexed, but crawling on its own isn't a ranking factor. 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 dataStructured data is a standardized way of labeling page content (using the schema.org vocabulary in JSON-LD, Microdata, or RDFa) so search engines can understand its meaning. It's not a direct ranking factor — its value is rich results and entity understanding., 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 indexA sitemap index is a sitemap of sitemaps — a single file that lists your other sitemap files instead of listing URLs directly. It's how large sites stay under the 50,000-URL / 50MB-per-sitemap limit while submitting just one file. aggregating sitemaps hosted elsewhere.
  • Encoding. UTF-8, always.
  • CompressionCompression (HTTP content encoding) shrinks text-based responses — HTML, CSS, JS, JSON, SVG, XML sitemaps — before they're sent over the network, using an algorithm like Gzip, Brotli, or Zstd, so the browser or crawler downloads fewer bytes. It's not a ranking factor, but it speeds up page loads and helps pages stay under crawler fetch limits.. 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 redirectsA redirect sends browsers and crawlers from a requested URL to a different one. An HTTP redirect specifically is a 3xx status code paired with a Location header; meta refresh and JavaScript redirects achieve a similar navigation without being a 3xx response themselves. Permanent redirects (301/308) are Google's signal the target should be canonical; temporary ones (302/303/307) aren't., 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 crawlingCrawling is how search engines use automated bots (like Googlebot and Bingbot) to discover URLs and download pages. A page has to be crawlable to be indexed, but crawling on its own isn't a ranking factor. allowed so Google can see it), a 404/410, or the removals toolA Google Search Console feature for verified owners to manage how their URLs appear in Search. A Temporary Removal hides a URL for about six months — it does not delete the page from the index.. 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 CMSsA content management system (CMS) is software that lets users create, manage, and publish digital content — like blog posts and pages — without writing raw code. WordPress, Drupal, and Joomla are the most common open-source CMS platforms. 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 hreflangHreflang is an annotation (in HTML, HTTP headers, or XML sitemaps) that tells search engines which language and optional region a page targets, and which alternate versions exist. It only works when every page in the cluster references all the others. 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 ConsoleA free Google service that reports how a site performs in Google Search and surfaces problems with how Google crawls, indexes, and serves it. It's first-party data straight from Google — but you don't need it to appear in results. — the Sitemaps reportThe Google Search Console report where you submit sitemaps and watch how Google processes them — type, last read date, status, and how many URLs were discovered. It confirms Google read your list; it doesn't prove anything got indexed. (or the Search Console APIA set of REST APIs that let you programmatically read and manage Google Search Console data for properties you've verified — Performance data, URL index status, sitemaps, and properties — authorized with OAuth 2.0.) is the primary submission method; it’s also where you read the submitted-vs-indexed diagnostic.
  • Bing Webmaster ToolsMicrosoft's free portal for monitoring and improving how a site appears in Bing search — the peer to Google Search Console, plus IndexNow instant indexing, richer backlink data, and keyword volumes. Because Bing's index also feeds Microsoft Copilot, it doubles as a window into AI-search visibility. — 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 sitemapA video sitemap is an XML sitemap (or mRSS feed) that uses the video:video extension to tell Google about videos hosted on your pages — the landing page, a thumbnail, a title, a description, and a link to the video file or player. It helps Google discover and surface video content, but it doesn't guarantee indexing. extensions — cover the rest of the family, and the broader discovery topic ties sitemaps to the other ways engines find your URLs.

TIP Validate the file you will actually submit

Catch XML and sitemap-protocol errors before Search Console does with my free XML Sitemap Validator Free

  1. Paste the XML, upload the file, or fetch the public sitemap URL.
  2. Fix parser and protocol errors first, including the wrong root element shown here.
  3. Fetch and validate the deployed URL again before submitting it to a search engine.
A file can be valid XML and still not be a sitemap. Search engines require a `urlset` or `sitemapindex` root element.

The completed validator result shows one error: Root element is not urlset or sitemapindex. It found a feed element instead and states that search engines will not recognize the file as a sitemap.

Add an expert note

Pin an expert quote

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