Skip to main content
Skip to main content
Technical SEO
Last reviewed: November 1, 2026

XML Sitemap Best Practices: Limits, lastmod & Sitemap Indexes

How to build and maintain clean XML sitemaps under the Sitemaps 0.9 protocol: size limits, lastmod rules, canonical purity, and sitemap index files.

Quick answer

An XML sitemap lists the canonical, indexable URLs on your site that you want search engines to crawl. Under the Sitemaps 0.9 protocol and Google Search Central rules, each sitemap file is capped at 50,000 URLs and 50MB uncompressed, must be UTF-8 encoded, and should include only 200 OK canonical URLs. Google uses accurate <lastmod> timestamps to schedule recrawls and ignores <priority> and <changefreq>.

Perfect SEO Tools Team
10 min read

An XML sitemap gives search engines a machine-readable inventory of the canonical URLs you want crawled and indexed, along with a timestamp indicating when each page's content last changed meaningfully. Defined by the Sitemaps.org 0.9 protocol and detailed in Google's Build and Submit a Sitemap guide, a clean sitemap accelerates URL discovery and helps you monitor index coverage by section in Google Search Console.

Protocol limits: 50,000 URLs, 50MB uncompressed, and UTF-8 encoding#

Every XML sitemap and sitemap index file must obey strict technical limits set by the Sitemaps 0.9 specification and enforced by Google and Bing:

  • Maximum URLs per sitemap file: 50,000 <url> entries per file.
  • Maximum file size: 50 MB (52,428,800 bytes) uncompressed. You may compress sitemaps with gzip (.xml.gz) to save bandwidth, but the uncompressed XML payload after decompression must still be under 50 MB.
  • Character encoding and escaping: The file must be UTF-8 encoded and escape XML entity characters (& as &amp;, ' as &apos;, " as &quot;, > as &gt;, < as &lt;).
  • Fully qualified absolute URLs: Every <loc> element must contain the full protocol and hostname (https://www.example.com/tools/seo-analyzer/, never /tools/seo-analyzer/).
  • Host and path scope: By default, a sitemap located at https://example.com/catalog/sitemap.xml is only permitted to list URLs under https://example.com/catalog/. Placing your sitemaps at the root directory (https://example.com/sitemap.xml)—or submitting them through Google Search Console for verified properties—allows them to cover the entire host.

Which XML tags Google uses—and which tags Google ignores#

The Sitemaps 0.9 schema defines four tags inside each <url> block, but Google's crawlers only use two of them:

XML TagRequired by Protocol?How Google Search Treats It
<loc>RequiredUsed: Must be the exact canonical URL (https, www vs non-www, and trailing slash matching your rel="canonical").
<lastmod>Optional (Highly Recommended)Used if consistently accurate: Google reads <lastmod> in W3C Datetime / ISO 8601 format (2026-11-01 or 2026-11-01T14:30:00+00:00) to decide when to recrawl a known URL.
<changefreq>OptionalIgnored by Google: Googlebot determines recrawl frequency from actual content changes and <lastmod>, not self-declared daily or weekly hints.
<priority>OptionalIgnored by Google: Because site owners routinely mark every page 1.0 or 0.9, Google ignores <priority> completely.

The <lastmod> accuracy rule#

In Google's documentation and Search Central updates on sitemaps, Google stresses that <lastmod> is only trusted when it reflects a verifiable, significant modification to the primary page content (such as updating an article's facts, adding a new section, or changing structured data and visible dates in lockstep).

Two <lastmod> anti-patterns cause Google to distrust and ignore a site's timestamps:

  1. Setting <lastmod> to the current build or request timestamp: If a static site generator or dynamic script stamps today's date onto all 5,000 URLs every time the site deploys or whenever Googlebot fetches sitemap.xml, Google detects that the page content did not actually change and stops trusting <lastmod> across the sitemap.
  2. Updating <lastmod> for minor chrome changes: Changing a copyright year in the footer, rotating a sidebar widget, or updating related-post links does not constitute a substantive change to the page's main content.

The golden rule of sitemap hygiene: 100% 200 OK canonical URLs#

An XML sitemap is a list of URLs you want search engines to index. Polluting a sitemap with non-indexable or non-canonical URLs wastes crawl budget and slows down discovery of your real pages. Before deploying a sitemap, verify that it excludes every one of the following:

  • 301 or 302 redirecting URLs: Including URLs without trailing slashes when your server redirects to trailing slashes forces unnecessary redirect hops.
  • 404, 410, or 5xx error URLs: Dead or unpublished draft URLs trigger Submitted URL not found (404) errors in Search Console.
  • Pages marked noindex (via meta tag or X-Robots-Tag): Submitting a URL in a sitemap while marking it noindex sends conflicting signals and triggers Submitted URL marked 'noindex' warnings in Search Console.
  • Non-canonical duplicates and parameter variants: Never include ?utm_, ?page=, ?sort=, or alternate URLs that canonicalize to another page. Read our canonical tag guide and verify your canonicals with our canonical tag manager.
  • URLs blocked by robots.txt: Check your rules against our robots.txt guide.

Structuring large sites with a Sitemap Index file#

Even if your site has only 3,000 URLs—well below the 50,000-URL hard ceiling— splitting your sitemap by content type or directory into child sitemaps and connecting them with a sitemap index file (<sitemapindex>) gives you a major diagnostic advantage in Google Search Console.

When you submit a sitemap index, Search Console lets you filter the Page Indexing report by individual child sitemap (sitemap-blog.xml, sitemap-tools.xml, sitemap-products.xml). That immediately shows you which template has an indexing drop, rather than hiding all templates inside one mixed URL bucket:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://www.example.com/sitemap-pages.xml</loc>
    <lastmod>2026-11-01</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://www.example.com/sitemap-blog.xml</loc>
    <lastmod>2026-11-01</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://www.example.com/sitemap-tools.xml</loc>
    <lastmod>2026-10-28</lastmod>
  </sitemap>
</sitemapindex>

You can generate valid <sitemapindex> XML files in seconds using our sitemap index generator. Note that a sitemap index file may reference up to 50,000 child sitemaps, but cannot nest another sitemap index file inside it.

How to submit your sitemap (and why the /ping endpoint is retired)#

Google's official sitemap submission documentation supports four methods for making your sitemap or feed available, spanning cross-engine declarations, manual Search Console submission, and programmatic automation:

  1. Declare Sitemap: in /robots.txt (cross-engine): Add an absolute Sitemap: line in your /robots.txt file so Google, Bing, and other crawlers discover it automatically on their next robots.txt fetch (you can generate this with our robots.txt generator):
    Sitemap: https://www.example.com/sitemap.xml
    
  2. Submit in Google Search Console (Indexing > Sitemaps): Submitting your sitemap or sitemap index in Search Console records the submission date, last read date, discovered URL count, and any XML parsing or fetch errors. Combine this check with the Search Console Crawl Stats report and our technical SEO audit guide.
  3. Automate via the Search Console Sitemaps API (Google programmatic): For large sites or CI/CD deployment pipelines that need programmatic Google submission, use the authenticated Google Search Console API (sitemaps.submit endpoint) rather than unauthenticated URL pings.
  4. Broadcast Atom/RSS updates via WebSub: If you publish an Atom or RSS feed alongside your XML sitemap, Google supports WebSub hub notifications to broadcast new or updated feed entries to subscribers including Googlebot.

Important deprecation note: Google officially retired the legacy unauthenticated HTTP ping endpoint (https://www.google.com/ping?sitemap=...) in late 2023 after finding that the vast majority of unauthenticated ping traffic was spam. Automated scripts that still ping that URL receive an HTTP 404. Instead of unauthenticated pings, keep <lastmod> accurate in your sitemap and use robots.txt, Search Console UI, the Search Console API, or WebSub for Google (alongside IndexNow for participating non-Google engines such as Bing and Yandex).

Frequently asked questions#

Does every site need Image, Video, or News sitemap extensions?#

Only if those media types are core to your search traffic. Standard HTML pages whose images are already in the DOM (and not hidden behind lazy-load scripts that omit src / srcset) are discovered during normal page rendering. Dedicated Google News sitemaps are only for publishers in Google News and must list only articles published in the last 48 hours. For multi-regional sites, you can embed xhtml:link annotations inside your sitemap as shown in our hreflang tags guide.

Why does Search Console say "Couldn't fetch" right after I submit a sitemap?#

Search Console occasionally displays a transient Couldn't fetch status while a newly submitted sitemap is queued for initial processing. First, inspect the exact sitemap URL in the URL Inspection tool (Test Live URL) to confirm that Googlebot receives HTTP 200 OK with an application/xml or text/xml Content-Type header and isn't blocked by a WAF bot rule.

Does an XML sitemap replace internal linking?#

No. An XML sitemap helps search engines discover URLs and detect modification dates, but it passes zero anchor-text context or internal PageRank. An orphan page listed only in sitemap.xml with zero internal HTML <a> links pointing to it will frequently remain unindexed or rank poorly.

Sources#

Don't Miss Our SEO Updates

Get the latest SEO tools and strategies delivered to your inbox.

No spam, unsubscribe anytime. We respect your privacy.

About the Author

The Perfect SEO Tools team consists of experienced SEO professionals, digital marketers, and technical experts dedicated to helping businesses improve their search engine visibility and organic traffic.

Related Articles

Technical SEO

Google Search Console Crawl Stats Report: Diagnose Crawl Budget

How to audit the Google Search Console Crawl Stats report to spot 5xx host failures, faceted parameter traps, and discovery vs refresh bottlenecks.

10 min read
Technical SEO

Hreflang Tags Guide: HTML, HTTP Headers, Sitemaps & x-default

How to implement hreflang annotations for multilingual and multi-regional sites: ISO language and region codes, bidirectional return links, and canonicals.

11 min read
Technical SEO

Robots.txt Guide: Syntax, Rules, and AI Crawlers

How robots.txt controls crawling: file location, rule matching, wildcards, error handling, and the user-agent tokens AI crawlers publish.

9 min read