The sitemap.xml file is the formal contract between a website and search engines — declaring which URLs the site owner wants indexed, when each was last modified, and how often content changes. A free sitemap validator parses this XML against the official Sitemaps.org Protocol 0.9 (introduced June 2005 by Google, Ask, MSN, and Yahoo!), checks for well-formedness, validates each
URL against Google’s 2,048-character hard limit and ISO 8601 lastmod datetime format, and produces a structured error report. The Sitemaps.org protocol is XML 1.0 namespaces plus a flat list of entries with mandatory and optional , , .
Table of Contents
- What a Sitemap Validator Does
- The Sitemaps.org Protocol 0.9 Specification
- XML Schema Validation: Required and Optional Elements
- Common Sitemap Errors and Their Causes
- Multi-Sitemap Patterns: The sitemap_index.xml Pattern
- Submitting a Sitemap to Google Search Console and Bing
- Beyond Standard Sitemap: Image, Video, News, and Hreflang Extensions
What a Sitemap Validator Does
A sitemap validator takes a sitemap.xml file as input (either via drag-and-drop, paste-text-area, or fetch-from-URL), parses it as XML against the Sitemaps.org Protocol 0.9 schema, and produces one of four outcomes:
- PASS: Well-formed XML, valid namespace, every
is a valid URL, every is ISO 8601 datetime, all 50,000-URL and 50-MB limits respected. - WARN: Valid XML but issues like non-canonical pagination, missing
, or unusual values. - ERROR: Invalid XML, missing namespace, broken
URLs, or sizes exceeding limits. - INFO: Valid XML but missing recommended elements (
, ).
Validators should additionally check the following seven common failure modes:
- Missing XML declaration (
<?xml version="1.0" encoding="UTF-8"?>) - Missing urlset envelope (the root
with the namespace) - Invalid encoding (most parses expect UTF-8)
- Relative URLs in
(must be absolute) - Duplicate
(Google will silently dedupe; report as warning) - Non-HTTP schemes (e.g.,
file://,ftp://) - >50,000 URLs or >50 MB uncompressed (must split via sitemap_index.xml)
The Sitemaps.org Protocol 0.9 Specification
Sitemaps.org Protocol 0.9 was published June 2005 (initial) and revised minor revisions through 2017. The full protocol requires the following XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/page-1</loc>
<lastmod>2026-07-19</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://example.com/page-2</loc>
</url>
</urlset>
Mandatory elements:
<?xml version="1.0" encoding="UTF-8"?>— XML declaration<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">— root envelope with namespace- At least one
<url>entry containing<loc>(the page URL)
Optional elements per <url>:
<lastmod>— ISO 8601 datetime of last modification<changefreq>—always|hourly|daily|weekly|monthly|yearly|never<priority>—0.0to1.0(default0.5, relative to other pages in the sitemap)
XML Schema Validation: Required and Optional Elements
A standard validator checks each
def validate_url_entry(entry):
loc = entry.find('loc')
if loc is None or not loc.text.strip():
return ERROR, "<loc> required and must contain a URL"
if not loc.text.startswith(('http://', 'https://')):
return ERROR, "<loc> must be absolute HTTP/HTTPS URL"
if len(loc.text) > 2048:
return ERROR, "<loc> exceeds 2,048 character Google limit"
lastmod = entry.find('lastmod')
if lastmod is not None:
try:
from datetime import datetime
datetime.fromisoformat(lastmod.text.replace('Z', '+00:00'))
except ValueError:
return ERROR, "<lastmod> not ISO 8601 datetime"
changefreq = entry.find('changefreq')
if changefreq is not None and changefreq.text not in ('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'):
return ERROR, "<changefreq> must be one of: always|hourly|daily|weekly|monthly|yearly|never"
priority = entry.find('priority')
if priority is not None:
try:
v = float(priority.text)
if not (0.0 <= v <= 1.0):
return ERROR, "<priority> must be between 0.0 and 1.0"
except ValueError:
return ERROR, "<priority> must be numeric"
return PASS, "valid"
Common Sitemap Errors and Their Causes
| Error | Cause | Fix |
|---|---|---|
xmlns missing |
Wrong namespace or copy-paste error | Use exact xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" |
| Relative URL in |
Most CMS-generated sitemaps use relative URLs | Force plugin to emit absolute URLs with base URL prefix |
Lastmod in YYYY-MM-DD HH:MM:SS |
Wrong ISO 8601 separator | Use YYYY-MM-DD (date-only) or RFC 3339 with timezone like 2026-07-19T08:30:00+00:00 |
| Decimals or negative | Clamp to [0.0, 1.0] |
|
| >50,000 URLs | Misconfigured CMS | Split into multiple sitemaps + create sitemap_index.xml |
| 503 errors when fetched by Google | Server rate-limiting | Increase sitemap serving rate limits or move to CDN |
| Hardcoded values | Wire sitemap generation to file-system mtime or DB row.updated_at |
Multi-Sitemap Patterns: The sitemap_index.xml Pattern
For sites with >50,000 URLs OR >50 MB uncompressed, the protocol requires splitting into multiple sitemaps and creating a sitemap_index.xml that references them:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-1.xml</loc>
<lastmod>2026-07-19</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-2.xml</loc>
<lastmod>2026-07-18</lastmod>
</sitemap>
</sitemapindex>
Limits at the index level: 50,000 sitemap references max, ~50 MB uncompressed. A site can have multiple sitemap_index.xml files if even this isn't enough.
Common services creating multi-sitemap setups: e-commerce with >50k products, news aggregators, large SaaS platforms with millions of pages.
Submitting a Sitemap to Google Search Console and Bing
After validation, the sitemap must be submitted to search engines:
- Google Search Console: https://search.google.com/search-console → Sitemaps → Add new sitemap → Enter
https://example.com/sitemap.xml(or sitemap_index.xml) → Submit. - Bing Webmaster Tools: https://www.bing.com/webmasters → Sitemaps → Submit sitemap.
- robots.txt (recommended): Add
Sitemap: https://example.com/sitemap.xmlline to/robots.txt. - Yandex Webmaster Tools: https://webmaster.yandex.com → Indexing → Sitemap files.
Submitting does NOT guarantee indexation or ranking — just makes the URLs "discoverable" via the sitemap pipeline. Google still needs to crawl and index before ranking can begin.
Beyond Standard Sitemap: Image, Video, News, and Hreflang Extensions
The Sitemaps.org Protocol 0.9 has XSD extensions covering specific content types:
- Image sitemap:
<image:image><image:loc>...</image:loc></image:image>for image-rich pages (Google Image Search). - Video sitemap:
<video:video><video:thumbnail_loc>...</video:thumbnail_loc></video:video>for video content (Google Video Search). - News sitemap: For news sites (<2-day-old content), speed up Google News indexing.
- Hreflang sitemap:
<xhtml:link rel="alternate" hreflang="..." href="..." />for multilingual sites (auto-detected by Google).
Example image sitemap entry:
<url>
<loc>https://example.com/article-1</loc>
<image:image>
<image:loc>https://example.com/image-1.jpg</image:loc>
<image:title>Image title text</image:title>
<image:caption>Optional caption text</image:caption>
</image:image>
</url>
Validators should optionally check these extensions and report missing coverage for image-rich pages.