SEO Tools

XML Sitemaps: How to Create and Submit One to Google

A complete XML sitemap guide: how to create one, which URLs to include, how to validate the file, and exactly how to submit it to Google Search Console.

4 min read·Updated 2026-04-13

An XML sitemap is a machine-readable list of the URLs you want crawled, complete with last-modified dates and priority hints. It will not rescue a weak site, but it removes doubt: new pages get discovered faster, orphaned content gets found at all, and you get a report every time a URL starts failing. This guide covers what to include, how to validate the file, and how to submit it properly.

What a sitemap actually does

Crawlers discover most pages by following links. A sitemap is a second path — a direct inventory that says exactly which URLs exist and when they last changed. Its biggest win is on large or poorly linked sites: a product page reachable only through three filter clicks has a thin chance of being crawled often, but the same URL in a sitemap gets requested on the next pass. Sitemaps also carry lastmod values, which help search engines decide whether a page needs re-crawling after you edit it.

The tags that matter

TagRequiredNotes
urlsetYesRoot element, declares the sitemap namespace
locYesFull absolute URL, including https and any subdomain
lastmodNoISO 8601 date — only useful if it reflects a real content change
changefreqNoMostly ignored by Google; keep it if other tools read it
priorityNoIgnored by Google — do not spend time tuning it

Which URLs belong in the sitemap

Only canonical, indexable, 200-status URLs. Every entry you add should pass these filters:

  • It returns a 200 response, not a redirect chain.
  • It carries a self-referencing canonical, not a canonical pointing elsewhere.
  • It has no noindex meta tag and is not blocked in robots.txt.
  • It is a page a human would bookmark — not search filters, tag archives, or session IDs.

A sitemap full of redirects and duplicates trains the crawler to ignore your sitemap. Quality beats quantity here every time.

Create and validate the file

  1. Export the list of published URLs from your CMS or crawl your own site.
  2. Filter the list using the four rules above.
  3. Generate the XML with the Sitemap Generator, adding realistic lastmod dates for pages you edited this month.
  4. Upload it as sitemap.xml at the domain root.
  5. Open the file in a browser and confirm it renders as valid XML with no parse error.

Then declare it in your robots.txt with a Sitemap: https://www.example.com/sitemap.xml line so every bot finds it without asking.

Submit it to Google

Open Search Console, choose the correct property, paste the full sitemap URL into the Sitemaps report, and submit. Within a day you get a count of discovered URLs plus an error list. Work the error list top to bottom: submitted but not indexed usually means canonical or noindex conflicts, while couldn't fetch means a 404, a robots.txt block, or a redirect on the sitemap URL itself.

Size limits and splitting

One sitemap file caps out at 50,000 URLs or 50 MB uncompressed, whichever comes first. Past that, split into multiple files and wrap them in a sitemap index file that lists each child sitemap with its own lastmod. Store every child under a consistent path such as /sitemaps/products.xml so the structure stays predictable as you grow.

Common errors that stall indexing

  • Listing http versions of pages that redirect to https.
  • Including URLs whose canonical points to a different address — Google drops them silently.
  • Generating lastmod dates automatically on every deploy, even when nothing changed.
  • Serving the sitemap with a wrong content type; it should be text/xml or application/xml.

If your canonical declarations are still in flux, fix them with the Canonical Tag Builder first, then regenerate the sitemap. Submitting a sitemap full of conflicting canonicals wastes weeks of crawl budget.

Frequently asked questions

Do I still need a sitemap if my site is small? Under about 100 well-linked pages, Google will find everything anyway. Submit one regardless — the error report alone is worth it, and it costs nothing to maintain.

How often should I resubmit? You rarely need to resubmit at all. Search Console re-crawls the same URL automatically; updating the file's contents is enough, and pinging is no longer necessary.

Can images and videos go in a sitemap? Yes. Add image:loc and video: tags to the URL entries, which raises the chance your images appear in image search results for those pages.

Tools used in this guide

Related guides