A sitemap validator has to answer two questions, and most only answer the first. The first is whether the file obeys the protocol: it is reachable, well-formed UTF-8 XML in the right namespace, under 50,000 URLs and 50MB uncompressed, with every <loc> absolute, escaped, on the same host and under the sitemap's own directory, and every <lastmod> a valid W3C date. The second is whether the file tells the truth: every listed URL returns 200 without a redirect, is the canonical form of that page, is not noindexed, is not blocked in robots.txt for the crawlers you care about, and carries a lastmod that changed when the content did. This guide is the full reference for both, with the numbers checked against sitemaps.org, Google and Bing, the commands to run each check yourself, and what Shopify, WordPress, Webflow and HubSpot generate for you.

It is the companion to our piece on why sitemaps still matter for AI search, which argues the case. This one assumes you are convinced and want to validate an XML sitemap properly, end to end.

Key takeaways

  • A file can pass every XML and schema check and still be wrong. Validation has four layers: fetch, parse, protocol, truth. Most sitemap checker tools stop after the third.
  • The hard limits are the same everywhere: 50,000 URLs and 50MB (52,428,800 bytes) uncompressed per file, 50,000 sitemaps per index, <loc> under 2,048 characters, UTF-8, the http://www.sitemaps.org/schemas/sitemap/0.9 namespace.
  • Google and Bing both ignore <changefreq> and <priority>. Both use <lastmod> only when it is accurate. A validator should test lastmod for plausibility, not just format.
  • Bing is the one search operator that explicitly ties sitemaps to AI answers: it describes them as a discovery and freshness signal for Copilot. The AI-only crawlers in our sources document their user agents, not their sitemap handling.
  • Run the truth checks on production after every deploy that touches routing, not only on staging and not only once.

What a sitemap validator actually has to check

Think of validation as four gates in sequence. Each one can only be tested once the gate before it has passed, and each catches a different class of failure. A tool that reports "valid" has usually tested the first three. The fourth, whether the content of the file is true, is where most real-world sitemaps fail, and it is the one that matters for crawlers deciding what to fetch.

EACH GATE CAN ONLY BE TESTED ONCE THE ONE BEFORE IT PASSES1FetchCHECKS200, no redirectNot robots-blockedNo login or challengeTYPICAL FAILUREHTML error pageserved with 2002ParseCHECKSWell-formed XMLUTF-8, escapedStraight quotesTYPICAL FAILUREOne raw & in aproduct URL3ProtocolCHECKSNamespace, tagsLimits, scopeW3C datesTYPICAL FAILUREwww and non-wwwhosts mixed4TruthCHECKSEvery URL 200Canonical, indexableReal lastmodTYPICAL FAILURERedirects listed,build-time datesMost tools stop hereWhere real sitemaps fail
Figure 1. What a sitemap validator has to check: four gates, each testable only after the previous one passes. Most tools stop after the protocol gate; the truth gate is where real sitemaps fail. Diagram based on the sitemaps.org protocol and Google's Sitemaps report documentation.

Gate 1: can the file be fetched?

The sitemap URL must return 200 directly to the crawler, without a login, a bot challenge or a robots.txt rule in the way. Google's Sitemaps report is explicit that it respects robots.txt when fetching sitemaps, and it records the sitemap URL exactly as you submitted it, without following redirects. Submit and advertise the final address, so that what you monitor is what crawlers fetch. Content type matters less than people think, but a sitemap served as an HTML page (a CMS 404 template with a 200 status is the usual cause) fails at the next gate.

Gate 2: is it well-formed XML?

Every opening tag closed, attributes quoted with straight quotes, special characters entity-escaped, a single root element, UTF-8 throughout. This is the gate where one unescaped ampersand in a product URL breaks the whole file. Google lists "Parsing error" and says the usual cause is exactly that.

Gate 3: does it obey the sitemap protocol?

Correct root element (urlset or sitemapindex) in the correct namespace, required child tags present, no duplicated tags inside one entry, limits respected, URLs absolute and in scope, dates in W3C Datetime. The sitemaps.org XML schema enforces most of this mechanically; the scope and size rules need separate checks.

Gate 4: is it true?

The protocol defines a sitemap as a list of URLs you want crawled. A list that includes redirects, 404s, noindexed pages, non-canonical duplicates or robots-blocked paths is valid XML that gives a crawler wrong instructions. Search Console reports some of this as "URLs not accessible" and "URLs not followed", but only after the fact, only for Google, and only for sitemaps you submitted. The rest of this guide treats gate 4 as part of validation, because a sitemap checker that stops at gate 3 gives you a green light on a file that may be actively misleading crawlers.

Sitemap validator rules: the protocol limits, with sources

The protocol at sitemaps.org has not changed in substance for years; its page footer is dated November 2016. Google and Bing restate the same core limits and add their own notes on what they do with each field. Where they agree, treat the rule as hard. Where they differ, the difference is almost always in what they ignore, not in what they reject.

Rulesitemaps.org protocolGoogleBing
URLs per sitemap fileNo more than 50,00050,000Up to 50,000
File size50MB (52,428,800 bytes), measured uncompressed50MB uncompressedNot restated; gzip supported
Sitemaps per index fileNo more than 50,000, same 50MB limitUp to 50,000 loc tagsOne index can reference up to 2.5 billion URLs
Index files per siteNot limitedUp to 500 per site in Search ConsoleNot stated
EncodingUTF-8, entity-escaped valuesUTF-8Not restated
<loc>Begins with the protocol, less than 2,048 charactersFully-qualified, absolute URLsNot restated
<lastmod>W3C Datetime, time optional; date the page changed, not the date the file was generatedUsed only if consistently and verifiably accurateTrue last modification of the content, ISO 8601 with a time
<changefreq>, <priority>Optional hints; priority 0.0 to 1.0, default 0.5IgnoredIgnored
Where URLs may liveSame protocol and host, under the sitemap's directoryRoot placement recommended; cross-site via Search Console or robots.txtNot restated

The size limit is measured after decompression

Gzip reduces bandwidth, not the limit. A sitemap.xml.gz of a few megabytes can decompress past 50MB, and both the protocol and Google say the uncompressed size is what counts. Long URLs and hreflang alternates are what push files over: Google notes that hreflang child elements do not count towards the URL limit, but every one of them still adds bytes. A site with ten language versions repeats each alternate block ten times, once per language URL, so it can reach the byte limit far below 50,000 entries.

Required tags and namespace

Only three tags are required: <urlset>, <url> and <loc>. For an index the equivalents are <sitemapindex>, <sitemap> and <loc>. The root element must declare xmlns="http://www.sitemaps.org/schemas/sitemap/0.9". Note the http: Google's own blog post on lastmod points out the namespace is on http and says that is working as intended, so a validator that "fixes" it to https has broken the file. Google's report lists "Incorrect namespace" and gives the classic typo of writing the version as .9.

Escaping and encoding

Five characters must be escaped in any data value: & as &amp;, ' as &apos;, " as &quot;, > as &gt;, < as &lt;. In practice only the ampersand shows up, in query strings and in product names that leak into URLs. Separately, URLs themselves must be percent-encoded: a space or a non-ASCII character in a path should arrive as %20 or its UTF-8 percent-encoding. Google's "Invalid URL" error calls out spaces, quotes and malformed schemes like htp://.

Scope: host, protocol and directory

This rule surprises people more than any other. A sitemap may only list URLs on its own protocol and host, and only under its own directory. One at /catalog/sitemap.xml can list /catalog/ pages and nothing above or beside them. One at https://www.example.com/sitemap.xml cannot list https://example.com/ pages, because a missing www is a different host. URLs outside scope are dropped, and Google reports them as "URL not allowed".

WHICH URLS A SITEMAP MAY LISTSitemap location: https://www.example.com/catalog/sitemap.xmlLISTED URLRESULThttps://www.example.com/catalog/shoes/AllowedSame protocol, host and directoryhttps://www.example.com/DroppedHigher level than the sitemaphttps://www.example.com/blog/new-range/DroppedSibling directoryhttps://example.com/catalog/shoes/DroppedDifferent host: no wwwhttp://www.example.com/catalog/shoes/DroppedDifferent protocolFix by moving the sitemap to the site root, or by proving control of the other host through its robots.txtor Search Console. Google reports dropped URLs as "URL not allowed" or "Path mismatch".
Figure 2. Scope rule: a sitemap may list only URLs on its own protocol and host, under its own directory; anything else is dropped. Diagram with example URLs, based on sitemaps.org and Google Search Console Help.

The two ways around the directory rule are to put the sitemap at the root, which Google recommends, or to prove control of the other host: list the sitemap in that host's own robots.txt, or verify both properties in Search Console. Cross-host sitemaps are legitimate when you serve all sitemaps from one asset host, but each site's robots.txt must point to them, or the URLs are out of scope for that site.

What crawlers do with each field, AI crawlers included

Validating a field only matters if someone reads it. The table above already shows the main pattern: <loc> and <lastmod> carry the information, the other two optional tags carry nothing for the two largest search operators. That should change how you spend validation effort.

lastmod is the field worth validating hardest

Google's 2023 post on the topic says lastmod is used as a signal for scheduling crawls of URLs it already knows about, but only when it "consistently" matches reality; a page that changed years ago but claims to have changed yesterday will eventually stop being believed. It also defines the word: last significant modification. Changing the primary text, structured data or links counts. A new footer or copyright year does not. Bing goes further and asks for the true modification time of the content, with a time component, not the time the sitemap was regenerated, and says accurate lastmod helps it decide what to recrawl, reindex or skip.

So a lastmod check has three parts, and only the first is about format:

  1. Format. W3C Datetime: 2026-07-08 or 2026-07-08T18:00:15+00:00. Google adds that a time without a time zone is invalid, which catches the common 2026-10-21T09:00:00 with no offset.
  2. Plausibility. No dates in the future, none before the site existed, and not every URL on the same date. A distribution where most pages share one date is the signature of a build timestamp.
  3. Agreement. The sitemap date, the page's visible "updated" date and the dateModified in its Article markup should agree. Our guide to content freshness and dates covers how to set that up at the source.

Leaving lastmod out is allowed. Google says it is fine to omit it for pages whose software cannot tell when they changed, such as a homepage or a category page that only aggregates other pages. An omitted date is better than an invented one.

changefreq and priority: validate the syntax, then stop

Google says it does not use either; Bing says both are ignored. The protocol itself warns that priority only expresses your relative preference within your own site. A validator should still reject invalid values, because an invalid value can make an otherwise valid file fail schema validation, but there is no benefit in tuning them. If your generator emits <priority>1.0</priority> on every URL, that is noise, not an error.

What AI crawlers document about sitemaps

This is where "for AI crawlers" needs an honest answer. Bing's July 2025 post, written by two Microsoft AI product managers, is the clearest statement from a search operator that runs an AI answer product: it presents sitemaps and accurate lastmod as how content stays discoverable and fresh in AI-powered search such as Copilot, says Bing revisits sitemaps typically at least once per day, and recommends IndexNow alongside them for near real-time change notification. It also says plainly that no tool can guarantee how content will appear in AI-generated results.

The AI-specific crawlers are a different story. OpenAI documents OAI-SearchBot as building the index behind ChatGPT's search features, Perplexity documents PerplexityBot as indexing pages for its answers, and Anthropic documents Claude-SearchBot for Claude's search results. Their pages describe what the agents do and how robots.txt applies to them; none of the pages in our sources says how, or whether, those agents read sitemaps. Gemini is different again: Google-Extended is not a crawler but a usage control over content Googlebot has already fetched, so for Gemini the sitemap matters exactly as much as it does for Google Search.

The practical conclusion is the same either way. A sitemap is the one machine-readable statement of which URLs you consider real, current and canonical. Every crawler that does read it, whether Bingbot feeding Copilot or Googlebot feeding Gemini grounding, should be able to trust every line. Validation is how you earn that.

Step by step: validate an XML sitemap from the command line

Every check below runs with tools that ship with macOS and most Linux distributions: curl, gzip, xmllint (from libxml2), xsltproc, grep, awk and Python's standard library. We ran each one against our own production sitemap while writing this. Replace https://example.com with your origin, and run them against production rather than staging, because staging hosts often serve a different file.

File checksOnce per sitemap, seconds, deterministic1Find every advertised sitemapcurl robots.txt, grep -i sitemap:2Fetch like a crawlerstatus, redirects, type, size after gunzip3Well-formed XMLxmllint --noout4Schemaxmllint --schema, extensions stripped5Count, scope, length, duplicatesxmllint --xpath count, grep, awk, uniq -d6lastmod format and plausibilityregex, future dates, date distributionTruth checksOne fetch per listed URL, run in parallelAEvery URL returns 200 directlyxargs -P 8 curl -w %{http_code}BEach URL is its own canonicalcompare rel=canonical with locCNothing listed is noindexedX-Robots-Tag header and meta robotsDNothing blocked per agenturllib.robotparser, one pass per agentEhreflang complete, reciprocalElementTree pairs check
Figure 3. The validation sequence used in this guide: six file checks, then five truth checks that fetch every listed URL. Diagram; commands as given in the steps below.

Step 1. Find every sitemap the site advertises

Start from robots.txt, because that is where crawlers start. Count the Sitemap lines: more than one is not wrong, but two generators advertising overlapping files is a common platform side effect worth catching early.

# Which sitemaps does robots.txt declare? (case-insensitive, any position in the file)
curl -s https://example.com/robots.txt | grep -i '^sitemap:'

# Also check the conventional locations, in case one exists but is not declared
for p in /sitemap.xml /sitemap_index.xml /sitemap-index.xml /wp-sitemap.xml; do
  printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "https://example.com$p")" "$p"
done

The protocol says the Sitemap directive is independent of the user-agent lines, so its position in robots.txt does not matter. It must be a full absolute URL.

Step 2. Fetch it the way a crawler would

# Status, final URL after redirects, content type and size in one line.
# -L follows redirects so you can see where they go; a crawler-facing sitemap should not need it.
curl -sS -L -o sitemap.raw \
  -w 'status=%{http_code} redirects=%{num_redirects} final=%{url_effective} type=%{content_type} bytes=%{size_download}\n' \
  https://example.com/sitemap.xml

# Decompress if it is gzip (by extension or by magic bytes), then measure the real size
if gzip -t sitemap.raw 2>/dev/null; then gunzip -c sitemap.raw > sitemap.xml; else mv sitemap.raw sitemap.xml; fi
wc -c < sitemap.xml        # must be 52428800 or less

You want status=200 redirects=0. If redirects is not zero, submit and advertise the final URL instead. If the content type is text/html, open the file: you are probably looking at an error page served with a 200 status.

It is also worth fetching once with a crawler's user agent token, because CDN and firewall rules usually match on the user agent string. This does not prove what the real crawler sees, since some CDNs also verify the crawler's IP range, but a 403 here is a definite problem:

for ua in Googlebot bingbot OAI-SearchBot PerplexityBot Claude-SearchBot; do
  printf '%-18s %s\n' "$ua" "$(curl -s -o /dev/null -w '%{http_code}' -A "$ua" https://example.com/sitemap.xml)"
done

Step 3. Check that it is well-formed XML

xmllint --noout sitemap.xml && echo "well-formed"

# The first bytes should be the XML declaration, not whitespace or a BOM-plus-blank-line
head -c 60 sitemap.xml | od -c | head -3

xmllint prints the line and column of the first error. The usual culprits are an unescaped &, a stray control character copied from a product description, or an HTML comment injected by a caching plugin. Leading whitespace before the XML declaration is reported by Google but, by its own description, does not prevent processing.

Step 4. Validate against the sitemap schema

sitemaps.org publishes XML schemas for both file types. They check the root element, the namespace, required tags, duplicate tags inside an entry, the allowed changefreq values, the priority range and a <loc> length between 12 and 2,048 characters.

curl -s -O https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
curl -s -O https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd

# Which kind of file is it?
xmllint --xpath 'name(/*)' sitemap.xml; echo     # urlset or sitemapindex

xmllint --noout --schema sitemap.xsd sitemap.xml      # for a urlset
xmllint --noout --schema siteindex.xsd sitemap.xml    # for a sitemapindex

There is a trap here that catches most people the first time. The schema accepts elements from other namespaces only in strict mode, so a perfectly valid sitemap that carries hreflang (xhtml:link) or image extensions fails with "No matching global element declaration". When we ran the schema check on our own bilingual sitemap it failed for exactly that reason. The fix is to validate the core sitemap elements separately, by stripping the extension elements first:

# core.xsl: keep only elements in the sitemap namespace, drop extensions
cat > core.xsl <<'EOF'
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:s="http://www.sitemaps.org/schemas/sitemap/0.9">
  <xsl:template match="s:*">
    <xsl:element name="{local-name()}" namespace="http://www.sitemaps.org/schemas/sitemap/0.9">
      <xsl:apply-templates select="s:*|text()"/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>
EOF
xsltproc core.xsl sitemap.xml | xmllint --noout --schema sitemap.xsd -

Then check the extension elements on their own terms, which for hreflang is covered further down.

Step 5. Count, then check scope, length and duplicates

# Number of entries (works for both file types)
xmllint --xpath 'count(/*/*[local-name()="url" or local-name()="sitemap"])' sitemap.xml; echo   # must be 50000 or less

# Extract every loc, one per line
grep -o '<loc>[^<]*</loc>' sitemap.xml | sed -e 's/<loc>//' -e 's#</loc>##' > urls.txt

# Scope: every URL must start with the sitemap's own origin and directory
grep -v '^https://example.com/' urls.txt                  # anything printed is out of scope

# Length, whitespace and duplicates
awk 'length($0) >= 2048' urls.txt                         # too long
grep -n '[[:space:]"]' urls.txt                            # unencoded spaces or quotes
sort urls.txt | uniq -d                                    # the same URL listed twice

The scope check is the one validators most often skip, and it is the one that catches the www/non-www and http/https mismatches Google reports as "Path mismatch" and "URL not allowed". If the sitemap lives in a subdirectory, extend the prefix to include that directory.

Step 6. Check every lastmod

grep -o '<lastmod>[^<]*</lastmod>' sitemap.xml | sed -e 's/<lastmod>//' -e 's#</lastmod>##' > lastmod.txt

# Format: W3C Datetime, date only or date-time with a zone (Z or +hh:mm)
grep -Ev '^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\.[0-9]+)?)?(Z|[+-][0-9]{2}:[0-9]{2}))?$' lastmod.txt

# Plausibility: dates in the future
awk -v t="$(date -u +%Y-%m-%d)" 'substr($0,1,10) > t' lastmod.txt

# Plausibility: how many URLs share the most common date?
cut -c1-10 lastmod.txt | sort | uniq -c | sort -rn | head -5
wc -l < lastmod.txt                                         # compare with the entry count

There is no fixed threshold for "too many on one day". A news site can legitimately update hundreds of pages daily. What you are looking for is a date that matches your last deploy rather than your last edit. If the top date in the distribution is the day you last shipped code and you did not touch content that day, the generator is reading build time.

A sitemap validator that stops at XML misses the important errors

Steps 1 to 6 prove the file is valid. The checks in this section prove it is true. They are slower, because they fetch every listed URL, so run them in parallel and with a modest concurrency to avoid tripping your own rate limits.

Every URL returns 200, directly

# Status code and redirect target for every URL, 8 at a time; prints only the problems
xargs -P 8 -I{} curl -s -o /dev/null -w '%{http_code} {} %{redirect_url}\n' {} < urls.txt \
  | grep -v '^200 '

Every line it prints is a URL to fix or remove. A 301 means the sitemap lists the old address: replace it with the target. A 404 or 410 means the page is gone: remove it. A 5xx means a server problem worth investigating separately. Google's guidance on "URLs not followed" is to replace redirecting URLs in the sitemap with the URLs that should actually be crawled, and to avoid JavaScript and meta-refresh redirects altogether.

Each URL is the canonical form

The sitemap, the page's canonical tag and your internal links must name the same URL. A sitemap that lists /page while the page declares /page/ as canonical is sending two signals about one page, and on our own site a trailing-slash inconsistency of exactly this kind left 46 pages indexed under two URLs each. Our guide to canonical and duplicate URLs covers the alignment; this is the check:

# Print URLs whose rel=canonical does not match the sitemap entry exactly
while read -r u; do
  c=$(curl -s "$u" | grep -io '<link[^>]*rel="canonical"[^>]*>' \
        | grep -o 'href="[^"]*"' | head -1 | cut -d'"' -f2)
  [ "$c" = "$u" ] || echo "MISMATCH $u -> ${c:-none}"
done < urls.txt

This simple pattern assumes rel comes before href inside the tag and that the canonical is in the HTML rather than an HTTP Link header. For a production check, parse the HTML properly; the shell version is good enough to find a systematic problem in a few minutes.

Nothing listed is noindexed

A noindex on a listed page is a contradiction: the sitemap asks for the page to be crawled, the page asks not to be indexed. It happens most often when a template-level noindex (for internal search results, filtered collections, thank-you pages) applies to URLs the generator also includes. Check both places a noindex can live, as explained in meta robots and X-Robots-Tag:

while read -r u; do
  h=$(curl -sI "$u" | grep -i '^x-robots-tag:.*noindex')
  m=$(curl -s "$u" | grep -io '<meta[^>]*name="robots"[^>]*noindex[^>]*>')
  [ -n "$h$m" ] && echo "NOINDEX $u"
done < urls.txt

Nothing listed is blocked for the crawlers you care about

A URL disallowed in robots.txt for a crawler cannot be fetched by that crawler, whatever the sitemap says. Python's standard library can test every URL against every agent in one pass:

python3 - <<'EOF'
from urllib.robotparser import RobotFileParser
rp = RobotFileParser("https://example.com/robots.txt"); rp.read()
urls = [l.strip() for l in open("urls.txt") if l.strip()]
for agent in ["Googlebot", "bingbot", "OAI-SearchBot", "PerplexityBot", "Claude-SearchBot", "Applebot"]:
    blocked = [u for u in urls if not rp.can_fetch(agent, u)]
    print(f"{agent:18} {len(blocked)} of {len(urls)} listed URLs blocked")
    for u in blocked[:5]: print("   ", u)
EOF

One caveat: Python's parser does plain prefix matching and does not implement the * and $ wildcards that Google and most AI operators support, so a file with wildcard rules needs a parser that implements them. The point of running it per agent is the failure we see most: a rule meant to stop a training crawler also blocks a search crawler. Our working robots.txt for AI crawlers shows how to separate the two.

Thin and orphaned entries: the sitemap checker step most audits skip

Two softer checks are worth doing once a quarter. First, compare the sitemap with your crawlable link graph: URLs in the sitemap that nothing links to are orphans, and pages you link to prominently that are missing from the sitemap are coverage gaps. Second, look at what kinds of URL dominate the file. If tag archives, internal search pages or parameter variants outnumber the pages you actually want cited, the generator's include rules need tightening, not the XML.

Common sitemap errors and how to fix them

Search Console's Sitemaps report is the most detailed public list of what goes wrong, and its error names are what you will see in practice. Each sitemap gets one of three statuses: Success, Has errors (anything that parsed is still queued for crawling) or Couldn't fetch. The table maps the errors we see most to their cause, their fix and the local check above that catches them before Google does.

Search Console errorWhat it meansFixCaught locally by
Couldn't fetchGoogle could not retrieve the file: 404, robots.txt block, server error, or an unresolved manual actionLoad the URL; check robots.txt; run a live URL Inspection on the sitemap URLSteps 1 and 2
Parsing errorThe XML could not be parsed, most often an unescaped character in a URLEscape & and the other four characters; strip control charactersStep 3
Unsupported format / Incorrect namespaceWrong header or namespace, curly quotes around attributes, a typo like .9Use http://www.sitemaps.org/schemas/sitemap/0.9 exactly, straight quotesStep 4
Invalid XML: too many tagsA tag such as <loc> appears twice inside one <url>One entry per URL, one of each tag per entryStep 4
Missing XML tagA required tag is missing in some entryEvery <url> needs a <loc>Step 4
Invalid dateNot W3C Datetime, an impossible date, or a time without a time zoneEmit YYYY-MM-DD, or a full time with Z or an offsetStep 6
Invalid URLSpaces, quotes, unsupported characters or a malformed schemePercent-encode paths; generate URLs from one functionStep 5
URL not allowed / Path mismatchURLs on a different host, protocol or higher directory than the sitemapMove the sitemap to the root, or fix the host form in the generatorStep 5 (scope)
Too many URLs / Sitemap file size errorMore than 50,000 entries, or more than 50MB uncompressedSplit into several files under a sitemap indexSteps 2 and 5
Nested sitemap indexesAn index lists itself or another indexIndexes list sitemaps only; flatten the hierarchyStep 4 and the index check below
Invalid URL in sitemap index file: incomplete URLThe index lists child sitemaps by relative pathUse absolute URLs for every childIndex check below
URLs not accessible / URLs not followedListed URLs error out, or redirect too many timesReplace redirects with their targets; remove dead URLsThe 200 check
Leading whitespaceWhitespace before the XML declarationRemove it; Google says it does not block processingStep 3

How Google treats a failing sitemap over time

Two behaviours are worth knowing before you panic or relax. If a fetch fails, Google retries for a few days and then stops, so a sitemap that has been broken for weeks needs resubmitting after the fix, not just fixing. And if Google has read a sitemap successfully before, a later failure does not make it forget what it learned; removing a sitemap from the report does not make Google forget the URLs either. To stop crawling of listed URLs you need robots.txt, noindex or removal, not a deleted sitemap entry.

What Search Console does not show you

The report only lists sitemaps submitted through it or its API, not ones discovered through robots.txt, and it shows at most 1,000 submitted requests. It also only tells you about Google. A sitemap that Search Console calls a Success can still list hundreds of redirects that Bing, and any AI crawler that reads sitemaps, will chase. That is the case for running the truth checks yourself.

Sitemaps report statusCouldn't fetchFile never retrievedLoad the URL yourself:404, 5xx or HTML page?robots.txt blocks thesitemap path?Live URL Inspection:crawl allowed, fetch ok?Fix, then resubmit:retries stop after daysHas errorsParsed URLs still queuedParsing or format error:steps 3 and 4Date or URL error:steps 5 and 6Scope or size error:steps 2 and 5URLs not accessible:run the 200 checkSuccessValid for Google onlyRun the 200 check:redirects still listed?Canonical and noindexchecksPer-agent robots checkincl. AI search agentsCompare discoveredwith indexed pagesSuccess means Google could read the file. It does not mean the URLs in it are true, or that Bing and other crawlers see the same thing.
Figure 4. Triage by Search Console status. Status names and retry behaviour from Google Search Console Help, Manage your sitemaps using the Sitemaps report; checked 2026-10-23.

Large and multilingual sites: index files and hreflang

Once a site passes 50,000 URLs, or approaches 50MB because of long URLs or hreflang, it needs several sitemaps under an index. The index has its own rules, and they are checked separately.

Rules for the sitemap index itself

  • One level only. An index lists sitemaps, never other indexes. Search Console reports a violation as "Nested sitemap indexes".
  • Absolute child URLs. A relative child path is resolved against the index's directory and usually 404s.
  • Same site, same directory or lower. Google requires child sitemaps to be on the same site as the index and in the same directory or below, unless you use cross-site submission.
  • Index lastmod describes the child file. The protocol says a <lastmod> on a <sitemap> entry is when that child file changed, not when its pages did. It lets a crawler skip children that have not changed, so it should change only when the child's contents do.

Google allows up to 500 sitemap index files per site in Search Console, each with up to 50,000 children. Bing describes one index as able to reference up to 2.5 billion URLs. Very few sites approach either limit; the useful question is how to split, not how far you can go.

How to split

Split by content type first (products, categories, articles, locations), then by a stable key within each type. A split that mirrors your content model makes the Page indexing report filterable by sitemap, which turns "how many of our product pages are indexed?" into a one-click question. Avoid splitting by date of creation unless the content is genuinely archival, because it concentrates every change in the newest file and leaves old files with lastmod values that never move.

Validating every child

# Validate the index, then run steps 3 to 6 on every child it lists
xmllint --noout --schema siteindex.xsd sitemap.xml
grep -o '<loc>[^<]*</loc>' sitemap.xml | sed -e 's/<loc>//' -e 's#</loc>##' > children.txt

# A child that is itself an index is a nesting error
while read -r c; do
  curl -s "$c" -o child.raw
  root=$( (gzip -t child.raw 2>/dev/null && gunzip -c child.raw || cat child.raw) | xmllint --xpath 'name(/*)' - 2>/dev/null)
  echo "$root $c"
done < children.txt | grep -v '^urlset '

Then aggregate across children: a URL listed in two children is a duplicate even though each file is individually clean.

Validating hreflang in a sitemap

For multilingual sites, the sitemap is a tidy place to declare which URLs are language versions of each other, and it is where most hreflang mistakes become visible. Google's rules for the sitemap method are strict and mechanical, which makes them easy to validate:

  1. Declare xmlns:xhtml="http://www.w3.org/1999/xhtml" on the root.
  2. Give each language version its own <url> entry.
  3. Inside every entry, list every alternate, including the page itself, as <xhtml:link rel="alternate" hreflang="…" href="…"/>.
  4. Use fully-qualified URLs in the alternates, in the same form as your canonicals.
  5. Make links reciprocal. Google says that if two pages do not both point to each other, the annotations are ignored.

The validator's job is to turn rule 5 into a check: build the set of (page, alternate) pairs from the whole file and report every pair whose reverse is missing.

python3 - <<'EOF'
import xml.etree.ElementTree as ET
ns = {"s": "http://www.sitemaps.org/schemas/sitemap/0.9", "x": "http://www.w3.org/1999/xhtml"}
root = ET.parse("sitemap.xml").getroot()
links = {}
for url in root.findall("s:url", ns):
    loc = url.findtext("s:loc", namespaces=ns).strip()
    alts = {l.get("href") for l in url.findall("x:link", ns) if l.get("rel") == "alternate"}
    if alts and loc not in alts: print("SELF MISSING", loc)
    links[loc] = alts
for page, alts in links.items():
    for a in alts - {page}:
        if a not in links: print("ALTERNATE NOT LISTED", page, "->", a)
        elif page not in links[a]: print("NOT RECIPROCAL", page, "->", a)
EOF

Run it after the canonical check, not before. A reciprocal hreflang set built on non-canonical URLs is consistent and still wrong. Multilingual GEO covers the rest of the language setup.

Platform specifics: what Shopify, WordPress, Webflow and HubSpot generate

Most sites do not write their sitemap by hand, so the useful validation question is often "what does my platform emit, and what can I control?" The answers differ more than the file format suggests.

PlatformWhere and whatWhat you can controlWhat to validate first
ShopifyAuto-generated at /sitemap.xml as an index over products, collections, blogs and pages; updates itselfNo documented way to customise it or exclude single URLsThat the store is not password-protected (crawlers cannot reach that sitemap at all), then the 200 and canonical checks on products
WordPressSince 5.5, a core index at /wp-sitemap.xml over public post types, taxonomies, author archives and the homepageFilters such as wp_sitemaps_post_types; disable with wp_sitemaps_enabled; most SEO plugins replace it at another URLWhich generator is live, that only one is advertised, and that "Discourage search engines" is unticked
WebflowGenerated at /sitemap.xml once enabled, rebuilt on every publish, lastmod on every URL, hreflang alternates for Localize sitesPer-page sitemap toggle; or paste a hand-written sitemap instead (not both)That excluded pages really are excluded, and the hreflang reciprocity check
HubSpotWebsite pages and blog posts added to /sitemap.xml automaticallyLanding pages are added one by one by hand; edits take up to thirty minutesThat every landing page you want crawled is actually listed

WordPress: find out which sitemap is live

The WordPress trap deserves its own paragraph. "Settings, Reading, Discourage search engines from indexing this site" does more than add a noindex tag: it disables the core sitemap, so /wp-sitemap.xml starts returning 404. A staging site promoted to production with the box still ticked loses its sitemap silently, and an SEO plugin that has replaced the sitemap URL will not warn you. Conversely, when a plugin is installed, the core sitemap and the plugin's sitemap can both exist, and both may be advertised. Step 1 above, run against /wp-sitemap.xml and the plugin's URL, tells you which situation you are in.

Shopify: validate what you can change

Since the Shopify sitemap cannot be edited, validation there is about upstream causes. If the 200 check finds redirects, they come from URL redirects configured in the admin or from renamed handles, and the fix is to update links and handles rather than the sitemap. If the canonical check finds mismatches, look at the theme's canonical tag and at collection-scoped product URLs. Shopify's own robots.txt can only be changed through the robots.txt.liquid template, which is also where an accidental block on a listed path would come from.

Webflow and HubSpot: check the exclusions and the additions

On Webflow the risk is pages that should have been excluded, such as utility pages or draft-looking collection items, being published with the sitemap toggle left on; the include list is the thing to read. On HubSpot the risk is the opposite: landing pages that never appear because nobody added them. In both cases, compare the sitemap against the list of pages you actually want crawled, which is the orphan-and-gap check from earlier.

Making sitemap validation permanent

Sitemaps break silently. A routing change, a trailing-slash rule, a CMS migration or a new plugin, and the file starts listing URLs that redirect or 404. Nothing errors and the build passes. The only defence is to run the checks automatically, at the points where breakage is introduced.

BUILDbefore deployWell-formed XMLSchema, core elementsCount and sizeScope prefixlastmod formatCATCHESGenerator bugsAFTER DEPLOYon productionSitemap URL 200robots.txt declares itEvery URL 200Canonical matchesCATCHESCDN rules, redirectmaps, host settingsWEEKLYscheduled sweepNoindex sweeprobots per agentlastmod distributionhreflang reciprocityCATCHESTemplate andplugin driftWEEKLYengine consolesSitemap statusParsing errorsDiscovered vsindexed per sitemapCATCHESWhat the engineitself saw
Figure 5. Where each check belongs. Build-time checks catch generator bugs; only the post-deploy run sees production-only failures such as CDN rules and redirect maps. Diagram, not measured data.

Where each check belongs

WhenChecksFails the run if
At build, before deployWell-formed XML, schema (core elements), entry count, size, scope prefix, lastmod formatAny error; these are deterministic and cheap
Right after deploy, on productionSitemap URL returns 200 directly; robots.txt declares it; every listed URL returns 200; canonical matchesAny non-200 listed URL, or any canonical mismatch
WeeklyNoindex sweep, robots.txt per agent, lastmod distribution, hreflang reciprocityNew problems compared with last week's run
Weekly, in Search Console and Bing Webmaster ToolsSitemap status, parsing errors, discovered versus indexed counts per sitemapStatus other than Success; a sudden drop in discovered pages

The build-time checks catch generator bugs. The post-deploy checks catch the class of failure that only exists in production: a CDN rule, a redirect map, a host canonicalisation that staging does not have. The weekly checks catch drift, such as a template change that started adding noindex to a section, or a plugin update that reintroduced a second sitemap.

Things that are not worth doing any more

  • Pinging Google. Google deprecated the sitemaps ping endpoint in June 2023; it stopped functioning 6 months later and returns 404. Submit through Search Console or robots.txt instead. For Bing and other engines that support it, IndexNow is the documented way to announce individual changes.
  • Tuning priority and changefreq. Ignored by both Google and Bing.
  • Adding a sitemap to a tiny site for its own sake. Search Console's help says a site of about 500 pages or fewer, where every page is reachable by links from the homepage, probably does not need one. If you have one anyway, it still has to be true.

A one-page checklist

  1. robots.txt declares the sitemap with an absolute URL, and only the generator you intend.
  2. The sitemap URL returns 200 with no redirect, to normal and crawler user agents.
  3. Uncompressed size is 52,428,800 bytes or less; entries are 50,000 or fewer per file.
  4. The file is well-formed UTF-8 XML with the sitemaps.org namespace exactly.
  5. Core elements validate against sitemap.xsd or siteindex.xsd, after stripping extensions.
  6. Every <loc> is absolute, encoded, under 2,048 characters, in scope, and unique.
  7. Every <lastmod> is valid W3C Datetime, not in the future, and not a build timestamp.
  8. Every listed URL returns 200 directly and is its own canonical.
  9. No listed URL is noindexed or blocked for Googlebot, Bingbot or the AI search agents you allow.
  10. Indexes are one level deep with absolute child URLs; hreflang sets are complete and reciprocal.

If you want the structural and reachability parts of this checklist run for you on a single sitemap, our free sitemap validator checks structure, coverage and whether the listed URLs are reachable.

Sources