XML Sitemap Format and Rules
A sitemap helps Google find your pages, but only if it follows the rules. This guide covers the supported formats, size limits, which tags Google ignores, when lastmod is trusted, where to put the file, how to submit it, and how to split a large sitemap with an index.
- 3 formats compared
- 50,000 URL limit
- lastmod rules
- Submit 4 ways
<urlset xmlns="...">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-01-15</lastmod>
</url>
</urlset>Use UTF-8, fully qualified absolute URLs and only the canonical URLs you want in results. One sitemap can hold 50 MB uncompressed or 50,000 URLs; split larger sets and group them under a sitemap index. Google ignores priority and changefreq and uses lastmod only when dates are consistently accurate. Put the file at the site root and submit it in Search Console or list it in robots.txt.
Supported formats
| Format | Good for | Notes |
|---|---|---|
| XML sitemap | Most flexible; can carry image, video, news and localised-version details | Can be tedious to maintain on large or fast-changing sites |
| RSS, mRSS, Atom 1.0 | Easy, since CMSs usually generate feeds | Usually list only recent URLs; cannot describe images or news; mRSS can describe video |
| Text sitemap | Simple: one URL per line | HTML and other indexable text pages only; file ends in .txt and contains only URLs |
Google has no format preference. Related guides: image sitemap and video sitemap.
Size limits and sitemap index files
Larger sets must be split into several sitemaps. You can submit a sitemap index that groups them, or submit each file. Submitting them separately lets you track performance per sitemap in Search Console.
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>https://example.com/sitemap-posts.xml</loc></sitemap> <sitemap><loc>https://example.com/sitemap-pages.xml</loc></sitemap> </sitemapindex>
URL rules
- Fully qualified. Use absolute URLs, not relative paths. Google crawls URLs exactly as listed.
- Canonical only. Include only the canonical URLs you want to appear in results. For separate mobile and desktop URLs, list one version, or list both with annotations.
- Escape special characters in tag values, as XML requires.
- Order does not matter.
For why canonical URLs matter, see canonical tags.
Which tags matter
| Tag | Google’s treatment |
|---|---|
| loc | The page URL, required |
| lastmod | Used only when dates are consistently and verifiably accurate; should reflect significant changes such as main content, structured data or links, not trivial edits like a copyright year |
| priority | Ignored |
| changefreq | Ignored |
Where the file lives
A sitemap can be hosted anywhere on the site, but unless it is submitted through Search Console it only covers URLs in its own directory and below. Placing it at the site root lets it cover the whole site, and that is the recommended location.
/sitemap.xml at the root
Covers every URL on the host.
/blog/sitemap.xml
Covers only /blog/ and below unless submitted through Search Console.
Build one step by step
Pick a format
XML for most sites; let your CMS generate it where possible.
List canonical URLs only
Leave out redirects, noindex pages and duplicates (my own advice).
Build the file
Hand-write for a few dozen URLs; generate programmatically for larger sites.
Stay under the limits
Use several files and an index if you pass 50,000 URLs or 50 MB.
Upload to the root
Open it in a browser to confirm it loads.
Tell Google
See the options below.
Submit it
Google says submitting is a hint, not a guarantee that it will fetch or use the file.
| Method | Detail |
|---|---|
| Search Console | The Sitemaps report shows when Googlebot accessed it and any errors; see submit a sitemap |
| Search Console API | Submit programmatically |
| robots.txt | Add a Sitemap: line with the full URL; multiple allowed |
| WebSub | For RSS or Atom feeds, to notify of changes |
Read results in the Sitemaps report.
Notes for WordPress sites
- Let the plugin do it. SEO plugins generate and update sitemaps (my own note). See Yoast SEO settings.
- One source only. Disable duplicate sitemap generators such as WordPress core’s if your plugin makes its own (my own advice).
- Check what is listed. Noindex or thin archives should not be in the sitemap.
- Cache. Make sure the sitemap is not cached stale.
Troubleshooting
| Symptom | Likely cause (my own diagnosis) | Fix |
|---|---|---|
| Could not fetch | Wrong URL or blocked | Open it in a browser; check robots.txt |
| Parsing errors | Unescaped characters or invalid XML | Escape and validate |
| Only part of the site covered | File in a subfolder | Move to the root |
| URLs not indexed | Sitemap is only a hint | Check the page indexing status |
| Too large | Over 50 MB or 50,000 URLs | Split with an index |
Checklist
File
- UTF-8
- Under 50 MB, 50,000 URLs
- At the root
- Returns 200
URLs
- Absolute and canonical
- Special characters escaped
- No redirects or noindex pages
- No duplicates
Tags
- loc present
- lastmod only if accurate
- Skip priority and changefreq
- No fake dates
Submit
- Search Console
- robots.txt Sitemap line
- Check report
- Recheck monthly
What Google’s page does not say
Google does not promise that every listed URL will be crawled or indexed, and the page does not say how often it re-reads a sitemap. It also does not define exactly when lastmod becomes trusted beyond requiring consistent, verifiable accuracy.
Key terms
- Sitemap index
- A file that lists other sitemap files.
- lastmod
- The date a page was last significantly changed.
- Canonical URL
- The preferred version of a page.
- WebSub
- A protocol to notify of feed updates.
Common mistakes
Listing non-canonical URLs
Wastes crawl attention.
Fake lastmod dates
Google stops trusting them.
Relative URLs
Not valid.
Relying on priority
Ignored by Google.
Subfolder placement
Limits coverage.
Exceeding limits
File may fail.
Related guides
Sitemap format questions
What is the size limit?
50 MB uncompressed or 50,000 URLs per sitemap.
Does Google use priority and changefreq?
No, it ignores both.
When does Google use lastmod?
Only when dates are consistently and verifiably accurate.
Which encoding?
UTF-8.
Where should the file go?
At the site root so it covers the whole site.
Can I list several sitemaps?
Yes, individually or grouped in a sitemap index.
Does submitting guarantee crawling?
No. It is a hint.
Can a text file be a sitemap?
Yes, one URL per line, ending in .txt.
Formats, limits, URL rules, tag handling, location and submission methods come from Google’s page. The index example, step-by-step routine, WordPress notes, troubleshooting table and checklists are my own.