An XML sitemap is a machine-readable inventory of URLs a site prefers search engines to discover and consider for Search. It is especially useful for large sites, new sites, migrations, rapidly changing inventories, orphan-risk content, and pages with important image, video, news, or localized metadata.
A sitemap is a hint. Submission does not guarantee that Google will fetch the file, crawl every URL, index every page, or rank it.
Do you need a sitemap?
Google says a sitemap can be particularly useful when:
- The site is large.
- The site is new and has few external links.
- Important pages are difficult to discover through normal navigation.
- The site contains substantial video, image, or news content.
- Alternate-language metadata needs to be supplied.
- A migration or large launch introduces many URLs.
A site of about 500 pages or fewer may not need one when every important page is comprehensively linked from the homepage and no specialized media discovery is required. Even then, a well-maintained sitemap is often inexpensive and useful for monitoring.
Do not use a sitemap to compensate for broken navigation. Important pages should still have crawlable internal links.
Choose a supported format
Google supports several sitemap formats:
| Format | Best suited to | Limitations |
|---|---|---|
| XML | Full canonical inventory; image, video, news, and hreflang extensions |
More complex to generate and validate |
| RSS, mRSS, Atom 1.0 | Recent pages and updates; some video metadata | Feeds usually contain only recent items; no image or news extensions |
| Text | A simple list of indexable page URLs | URLs only; no metadata or extensions |
Google says it has no ranking preference among supported formats. XML is the most versatile and is the focus of this guide.
Minimal valid XML sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/products/green-dress</loc>
<lastmod>2026-07-18</lastmod>
</url>
</urlset>
Requirements and practical rules:
- Encode the file as UTF-8.
- Use the sitemap protocol namespace.
- Use fully qualified, absolute URLs.
- XML-escape special characters in tag values.
- Return a successful response and a suitable XML content type.
- Include only URLs covered by the sitemap location or an authorized cross-site setup.
- Keep the file publicly accessible to Googlebot without login.
URL order does not matter to Google.
Include only preferred canonical URLs
A sitemap tells Google which URLs the site prefers to show. Include URLs that are:
- Publicly accessible.
- Returning a successful response.
- Allowed to be crawled.
- Free of
noindex. - Canonical to themselves when intended as standalone pages.
- Current and useful.
- The preferred protocol, hostname, case, path, slash, and parameter form.
Exclude URLs that:
- Redirect.
- Return 4xx or 5xx.
- Require authentication.
- Are blocked by robots.txt.
- Contain
noindex. - Canonicalize to another URL.
- Represent filters, tracking, sessions, internal search, or duplicates not intended for Search.
- Are staging, preview, admin, or private routes.
Sitemapping a duplicate is a weak canonical signal for that duplicate, which can contradict a rel="canonical" pointing elsewhere.
Use <lastmod> accurately
Google uses <lastmod> when it is consistently and verifiably accurate. It should represent the last significant page update, such as a change to:
- Primary content.
- Structured data.
- Important links on the page.
- Material product, event, availability, or factual information.
It should not change because of:
- A footer copyright year.
- A request-time timestamp.
- An unchanged template render.
- A routine sitemap regeneration.
- A cosmetic change with no material page impact.
Use W3C date or datetime format. The date belongs to the page entry, not the time Google last crawled it.
Google ignores sitemap <priority> and <changefreq> values. Do not invest in maintaining them.
Respect size limits
One sitemap is limited to:
- 50,000 URLs, and
- 50 MB uncompressed.
If either limit would be exceeded, split the inventory and use a sitemap index.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemaps/products-1.xml.gz</loc>
<lastmod>2026-07-18</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemaps/categories.xml.gz</loc>
<lastmod>2026-07-17</lastmod>
</sitemap>
</sitemapindex>
A sitemap index can contain up to 50,000 sitemap locations. Google currently allows up to 500 submitted sitemap index files per site in Search Console.
Child sitemaps normally need to be hosted on the same site and within the index file's directory scope unless cross-site submission is configured.
Segment sitemaps for diagnosis
Splitting only at 50,000 URLs satisfies the protocol but can make diagnosis difficult. Segment by stable, meaningful cohorts such as:
- Page type: products, categories, articles, locations.
- Publication period for large archives.
- Language or country.
- Active versus recently expired inventory.
- Site section or business unit.
- Images, videos, or news where extensions differ.
Good segmentation helps answer:
- Which template is not being indexed?
- Did a migration affect one section?
- Are new products discovered faster than old archives?
- Which sitemap contains redirects, errors, or noncanonical URLs?
Avoid thousands of tiny files with unstable membership. A URL should normally appear in one logical canonical sitemap, although duplicate appearance is counted only once in Search Console's discovered-page total.
Sitemap index <lastmod> is different
Within a sitemap index, <lastmod> describes when the referenced sitemap file changed, not when any arbitrary page was crawled. Update it when that child sitemap's meaningful content changes.
This can help Google schedule sitemap fetches. Do not touch every child timestamp when only one file changed.
Add image, video, news, and localized metadata
XML extensions can add discoverability information without creating separate sitemap files for each type.
Use Google's dedicated rules because requirements differ:
- Image: Associate image URLs with a page.
- Video: Describe the primary video and required metadata.
- News: Include eligible recent news articles and required publication information.
- Localized versions: Add reciprocal
xhtml:link rel="alternate" hreflang="..."annotations.
You can combine supported extensions in one XML sitemap. Keep the page URL in <loc> canonical and ensure extension URLs are fetchable.
A successful sitemap parse does not guarantee that an image, video, news article, alternate, or page will be indexed.
Choose a location
Hosting the sitemap at the site root is simplest because a sitemap discovered without Search Console normally applies only to URLs at or below its directory.
Example:
https://example.com/sitemap.xml
can cover the site, while:
https://example.com/store/sitemap.xml
normally covers the /store/ hierarchy and below unless submitted through an authorized mechanism.
Cross-site sitemap hosting is possible when ownership of all included sites is verified in Search Console or each site's robots.txt explicitly references its own externally hosted sitemap. Configure it deliberately; a random external file cannot submit URLs for an unverified site.
Submit the sitemap
Google supports these methods:
Search Console Sitemaps report
Submit the sitemap or sitemap-index URL. This provides last-read status, discovered-page counts, and fetch or parsing errors.
robots.txt declaration
Add an absolute sitemap line:
Sitemap: https://www.example.com/sitemap.xml
Multiple Sitemap: lines are allowed.
Search Console API
Use the Sitemaps resource to submit, list, inspect, or delete submitted sitemap records programmatically.
WebSub for RSS or Atom
Sites using supported feeds can broadcast updates with WebSub.
Submission is a hint. Google says it does not guarantee downloading the sitemap or crawling its URLs.
Read the Sitemaps report
The top-level status describes the latest submitted request:
- Success: Google fetched and processed the sitemap without reported errors.
- Couldn't fetch: Google could not retrieve the file.
- Sitemap had X errors: Google fetched it and parsed some content but found errors.
The report shows only sitemap requests submitted through Search Console or the API. A sitemap discovered solely through robots.txt may not appear until it is explicitly submitted.
The report shows up to 1,000 submitted requests even if more exist.
Discovered pages
This is the number of unique page URLs parsed from the sitemap or all children of an index. It does not mean the URLs were crawled or indexed.
Filter the Page Indexing report by a specific sitemap to compare intended inventory with indexing reasons.
Analyze sitemap indexation
Do not rely on one “indexation rate” without classifying outcomes. For each sitemap cohort, calculate:
indexed share = indexed canonical URLs / valid submitted canonical URLs
Then examine non-indexed reasons:
- Redirect, duplicate,
noindex, or 404 → the sitemap inventory is probably wrong. - Server, access, robots, or fetch errors → technical delivery issue.
- Discovered – currently not indexed → discovery/capacity/demand investigation.
- Crawled – currently not indexed → content, rendering, duplication, and purpose investigation.
The denominator should exclude URLs that should never have been submitted. A lower indexed share is not automatically a Google problem if the sitemap lists noncanonical inventory.
Keep sitemaps synchronized with lifecycle events
New page
Add the canonical URL after it is public, linked, and indexable. Set accurate <lastmod>.
Updated page
Keep the URL and update <lastmod> only for a significant change.
Moved page
Replace the old URL with the new canonical URL. Keep the old-to-new permanent redirect; do not keep redirect sources in the canonical sitemap.
Removed page
Remove it from the sitemap and return 404/410 when there is no replacement, or redirect to a close replacement.
Temporarily unavailable page
Avoid churning the sitemap for brief incidents. Restore the appropriate response quickly.
noindex or private page
Remove it from the sitemap. A canonical discovery file should not advertise a URL the site forbids from indexing.
Resubmit only when useful
Google periodically recrawls a successfully processed sitemap independently of the normal site crawl schedule.
Resubmit when:
- A fetch or critical parse failure was fixed.
- The sitemap URL changed.
- The sitemap's structure or inventory changed substantially and urgent processing is justified.
Do not submit the same unchanged sitemap multiple times per day. Accurate file content and modification evidence are more useful than repeated submission.
Deleting a sitemap from Search Console removes its report entry; it does not make Google forget previously discovered URLs or necessarily stop fetching a sitemap known elsewhere.
Quality-control checks
Automate checks before publishing:
- XML well-formed and UTF-8 encoded.
- Required namespace and tags present.
- Under both size limits after uncompressed calculation.
- Absolute, correctly escaped URLs.
- Expected host, protocol, directory scope, and locale.
- Every page returns the intended response.
- No redirects, errors,
noindex, blocks, or foreign canonicals. <lastmod>is plausible and not inappropriately regenerated.- Child sitemap URLs in an index are fetchable.
- Counts match the publishing database by cohort.
Sample rendered pages too; protocol validity cannot tell whether an indexable URL provides useful content.
Common mistakes
- Treating sitemap submission as an indexing guarantee.
- Including every discovered URL rather than preferred canonicals.
- Listing redirects, 404s,
noindex, blocked pages, or duplicates. - Using relative URLs.
- Faking
<lastmod>on every build. - Maintaining ignored
<priority>and<changefreq>values. - Exceeding 50,000 URLs or 50 MB uncompressed.
- Creating thousands of tiny, unstable sitemaps.
- Expecting the Sitemaps report to list files known only from robots.txt.
- Deleting a report entry and expecting URLs to disappear from Google.
- Resubmitting unchanged files repeatedly.
- Ignoring internal navigation because a sitemap exists.