Skip to content

XML Sitemaps: Create, Optimize, and Submit Guide

Last Updated: August 22, 2026

An XML sitemap is a roadmap for search engines. It lists the URLs you want crawled and provides metadata about each one: when it was last updated, how often it changes, and how important it is relative to other pages on your site. A well-crafted sitemap helps search engines discover content faster, prioritize important pages, and understand your site structure. For guidance on controlling crawler access, see our robots.txt guide. To verify your pages are actually being indexed after sitemap submission, read our guide to checking indexation.

This guide covers everything from creating your first sitemap to optimizing it for large sites and submitting it to Google and Bing. Start by checking your existing sitemap with our XML sitemap checker.

What is an XML sitemap?

An XML sitemap is a file in XML format that lists URLs on your site along with optional metadata for each URL. It lives at a predictable location (usually /sitemap.xml) so search engines can find it automatically.

A basic sitemap looks like this:

<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n  <url>\n    <loc>https://example.com/page1</loc>\n    <lastmod>2026-08-20</lastmod>\n    <changefreq>monthly</changefreq>\n    <priority>0.8</priority>\n  </url>\n  <url>\n    <loc>https://example.com/page2</loc>\n    <lastmod>2026-08-15</lastmod>\n    <changefreq>weekly</changefreq>\n    <priority>0.6</priority>\n  </url>\n</urlset>

Do you need a sitemap?

Google says a sitemap is not required for small sites (under a few thousand pages) that are well-linked internally. However, a sitemap is still recommended because it:

  • Helps new pages get discovered faster
  • Provides metadata (lastmod) that helps Google prioritize recrawls
  • Lists pages that may not be reachable through internal links (orphan pages)
  • Communicates your site structure to search engines
  • Helps with debugging indexing issues (what you include vs. what Google indexes)

For large sites (thousands of pages), a sitemap is essential. For any site that publishes new content regularly, a sitemap accelerates indexing.

How to create a sitemap

CMS plugins and built-in features

Most modern CMS platforms generate sitemaps automatically:

  • WordPress: Yoast SEO, Rank Math, and other SEO plugins generate sitemaps automatically.
  • Shopify: Generates a sitemap at /sitemap.xml automatically.
  • Squarespace, Wix, Webflow: All generate sitemaps built-in.
  • Custom sites: Use a sitemap generator tool or write a script that crawls your site and outputs XML.

Sitemap index files

A sitemap file can list up to 50,000 URLs and must be under 50MB uncompressed. If your site has more than 50,000 pages, use a sitemap index file that points to multiple sitemaps.

Optimizing your sitemap

Include only canonical URLs

Your sitemap should list only the URLs you want indexed. Exclude:

  • Redirected URLs (301 or 302)
  • Non-canonical URLs (canonical points to a different URL)
  • 404 or 410 pages
  • Parameter URLs that duplicate content
  • Pages with noindex tags
  • Pages blocked by robots.txt

Use the XML sitemap checker to validate that every URL in your sitemap returns a 200 status and has a self-referencing canonical.

Use accurate lastmod dates

The lastmod field tells search engines when the page content last changed. Use accurate dates, not the current date for every page. If you update a page, update its lastmod. If a page has not changed in months, leave the old date.

Only update lastmod when the main content changes. Menu updates, template changes, or ad rotations do not count as content changes.

Set appropriate priority

The priority field (0.0 to 1.0) indicates the relative importance of a page within your site. Set higher priorities for your most important pages:

  • Homepage: 1.0
  • Money pages (product, service, pricing): 0.8-0.9
  • Blog posts and articles: 0.5-0.7
  • Category pages: 0.7-0.8
  • Archived or outdated content: 0.3-0.4

Set changefreq realistically

The changefreq field suggests how often a page changes. Google largely ignores this field, but it is still worth setting accurately:

  • Daily for news sites or frequently updated pages
  • Weekly for blogs that post regularly
  • Monthly for evergreen content
  • Yearly for static pages like About or Contact

Submitting your sitemap to search engines

Google Search Console

Submit your sitemap in Google Search Console:

  • Go to Sitemaps in the left navigation
  • Enter your sitemap URL (e.g., sitemap.xml)
  • Click Submit

Google will crawl the sitemap and report the number of URLs discovered, indexed, and any errors.

Bing Webmaster Tools

Submit your sitemap in Bing Webmaster Tools under Configure My Site > Sitemaps. Bing also accepts sitemap submissions via the API.

robots.txt reference

Even after submitting to Search Console, add a sitemap directive in your robots.txt file so all search engines can find it:

User-agent: *\nDisallow: /admin/\n\nSitemap: https://example.com/sitemap.xml

Use the robots.txt checker to verify the sitemap URL is listed and accessible.

Common sitemap mistakes

  • Listing redirected URLs: Every URL in the sitemap should return 200. Redirects waste crawl budget.
  • Missing important pages: Pages not linked internally and not in the sitemap may never be discovered.
  • Stale lastmod dates: Updating lastmod for every page every day makes the field meaningless.
  • Too many URLs in one file: Exceeding 50,000 URLs or 50MB will cause the sitemap to be rejected.
  • Not updating after site changes: After a redesign, migration, or restructuring, regenerate and revalidate your sitemap.
  • Including noindex pages: A sitemap entry says "crawl this." A noindex tag says "do not index this." These contradict each other.
  • Forgetting images and videos: Sitemaps can include image and video metadata to help those assets get indexed.

Monitoring sitemap health

Make sitemap checks part of your regular SEO maintenance:

  • Use the XML sitemap checker monthly to verify all URLs return 200
  • Compare sitemap URLs against indexed URLs in Search Console
  • Check for new errors or warnings in the Sitemaps report
  • After any site migration, revalidate the entire sitemap
  • Keep the sitemap under 50,000 URLs and 50MB; use a sitemap index if needed

Advanced: dynamic sitemaps

For large or frequently updated sites, generate sitemaps dynamically rather than statically. A dynamic sitemap pulls from your database and updates automatically as content is added, modified, or removed. Most CMS SEO plugins do this automatically.

Pair dynamic sitemaps with a ping mechanism: Google supports sitemap pings to notify them of updates. However, pinging is less important now that Search Console provides the discovery mechanism.

Sitemap checklist

  • Every URL in the sitemap returns 200 status code
  • No redirected, noindexed, or 404 pages in the sitemap
  • Accurate lastmod dates reflecting real content changes
  • Priority values reflect actual page importance
  • Sitemap is under 50,000 URLs and 50MB
  • Submit sitemap to Google Search Console and Bing Webmaster Tools
  • List sitemap URL in robots.txt
  • Monitor for errors monthly with the XML sitemap checker

A sitemap is not a set-and-forget asset. Treat it as a living document that reflects the current state of your site. A clean, accurate sitemap is one of the simplest ways to improve how search engines crawl and index your content.

Related Articles

Related Tools