// SEO plans from €35/hour or €395/month// from €35/hr · €395/mo Free SEO checker[email protected]+31 6 4555 9353
Free SEO audit
technical seo

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
sitemap.xmlformat
<urlset xmlns="...">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2026-01-15</lastmod>
  </url>
</urlset>
// quick answer
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

FormatGood forNotes
XML sitemapMost flexible; can carry image, video, news and localised-version detailsCan be tedious to maintain on large or fast-changing sites
RSS, mRSS, Atom 1.0Easy, since CMSs usually generate feedsUsually list only recent URLs; cannot describe images or news; mRSS can describe video
Text sitemapSimple: one URL per lineHTML 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

max size50 MBuncompressed
max URLs50,000per sitemap
encodingUTF-8required
split withindexfile

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>
The sitemap index example is my own illustration of the standard format; the sitemap files named are placeholders.

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

TagGoogle’s treatment
locThe page URL, required
lastmodUsed 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
priorityIgnored
changefreqIgnored

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.

recommended

/sitemap.xml at the root

Covers every URL on the host.

limited

/blog/sitemap.xml

Covers only /blog/ and below unless submitted through Search Console.

Build one step by step

1
choose

Pick a format

XML for most sites; let your CMS generate it where possible.

XMLRSStext
2
select

List canonical URLs only

Leave out redirects, noindex pages and duplicates (my own advice).

canonical
3
generate

Build the file

Hand-write for a few dozen URLs; generate programmatically for larger sites.

CMSscript
4
split

Stay under the limits

Use several files and an index if you pass 50,000 URLs or 50 MB.

sitemap index
5
publish

Upload to the root

Open it in a browser to confirm it loads.

200 OK
6
submit

Tell Google

See the options below.

Search Consolerobots.txt

Submit it

Google says submitting is a hint, not a guarantee that it will fetch or use the file.

MethodDetail
Search ConsoleThe Sitemaps report shows when Googlebot accessed it and any errors; see submit a sitemap
Search Console APISubmit programmatically
robots.txtAdd a Sitemap: line with the full URL; multiple allowed
WebSubFor 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

SymptomLikely cause (my own diagnosis)Fix
Could not fetchWrong URL or blockedOpen it in a browser; check robots.txt
Parsing errorsUnescaped characters or invalid XMLEscape and validate
Only part of the site coveredFile in a subfolderMove to the root
URLs not indexedSitemap is only a hintCheck the page indexing status
Too largeOver 50 MB or 50,000 URLsSplit 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

mistake 1

Listing non-canonical URLs

Wastes crawl attention.

List canonical only.
mistake 2

Fake lastmod dates

Google stops trusting them.

Update only on real changes.
mistake 3

Relative URLs

Not valid.

Use absolute URLs.
mistake 4

Relying on priority

Ignored by Google.

Drop it.
mistake 5

Subfolder placement

Limits coverage.

Use the root.
mistake 6

Exceeding limits

File may fail.

Split it.

Related guides

faq

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.

sources

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.

Scroll to Top