ToolBrainy

The Complete XML Sitemap Guide (2026)

Written by

in

An XML sitemap lists the canonical URLs you want search engines to discover. Create or locate the sitemap, check its URLs, and submit it in Search Console. A successful submission does not guarantee indexing.

What is an XML sitemap?

An XML sitemap is a machine-readable file — almost always at /sitemap.xml — that lists the URLs on your site you want search engines to crawl and index. Each entry can include a few optional hints: when the page was last modified, how often it changes, and its relative priority.

Think of it as the index at the back of a book. Search engines can find your pages by following links, but a sitemap provides another discovery path but does not guarantee that every listed URL will be crawled or indexed — especially deep pages, newly published content, or pages that aren’t linked from many places yet.

What a real sitemap looks like

A minimal, valid XML sitemap follows the sitemaps.org protocol and looks like this:

sitemap.xml

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2026-07-01</lastmod>
  </url>
  <url>
    <loc>https://example.com/blog/</loc>
    <lastmod>2026-07-15</lastmod>
  </url>
</urlset>

A URL sitemap requires the <urlset> wrapper with the correct namespace, a <url> element for each entry, and a <loc> inside each entry. Everything else is optional. In practice, <lastmod> is the one extra field worth keeping accurate — Google uses it as a hint for re-crawling. Google ignores <changefreq> and <priority>, so don’t lose sleep over them.

Sitemap index files (for bigger sites)

A single sitemap can hold up to 50,000 URLs or 50 MB uncompressed, whichever comes first. Larger sites split their URLs across several sitemaps and tie them together with a sitemap index file:

sitemap-index.xml

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/post-sitemap.xml</loc>
  </sitemap>
  <sitemap>
    <loc>https://example.com/page-sitemap.xml</loc>
  </sitemap>
</sitemapindex>

This is exactly how WordPress, Yoast and most CMS platforms structure things by default: one index that points to separate sitemaps for posts, pages, categories and so on. You submit the index once and search engines discover the rest.

Do you actually need a sitemap?

Honest answer: a small, well-linked site (say, under 100 pages where everything is reachable from the menu) will get crawled fine without one. But a sitemap becomes genuinely valuable when:

  • Your site is large, or grows quickly.
  • You publish new content often and want it discovered fast.
  • Some pages aren’t well linked internally (orphan pages).
  • Your site is new and has few backlinks pointing in.
  • You have rich media (images, video) you want surfaced in the right places.

There’s no downside to having one, so the practical rule is simple: always publish a sitemap. It costs nothing and only helps discovery.

Choose which URLs to include

Start with public pages you want indexed. For each entry, prefer the final canonical URL returning a successful response. A sitemap is not a list of every address your server can generate.

  • Include: useful articles, product or service pages, and other canonical public pages intended for search.
  • Exclude redirects: list the final destination instead of its old URL.
  • Exclude missing pages: remove deleted URLs returning 404 or 410.
  • Exclude noindex pages: keep search-excluded pages out of the sitemap, even when they return HTTP 200.
  • Remove duplicates: avoid fragments, tracking parameters and alternate URLs for the same content unless they are intentionally distinct canonical pages.

If a URL is blocked or noindexed unintentionally, fix the page’s configuration rather than merely deleting it from the sitemap. Read how to check noindex conflicts before submitting URLs.

How to create an XML sitemap

WordPress

Since WordPress 5.5, core generates a sitemap automatically at /wp-sitemap.xml. If you use an SEO plugin (or the WPOS SEO engine), you’ll usually get a richer, cleaner sitemap at /sitemap.xml or /sitemap_index.xml. You rarely need to build one by hand.

Shopify

Shopify auto-generates /sitemap.xml for every store, split into products, collections, pages and blogs. It updates automatically — you just submit the URL.

Static or custom sites

For a hand-built site or a small custom app, the fastest route is a generator: paste the complete URLs you want to include and download a ready-to-upload file. Our free XML Sitemap Generator does exactly this — no signup, and the file is built right in your browser.

Build a sitemap from a manual URL list

1. Collect canonical URLs

Export or assemble the full public URLs you intend to list. Check the hostname and protocol, remove duplicates, and keep a copy of the list for later updates. Our generator does not crawl a homepage or verify that each URL is indexable.

2. Generate and inspect the XML

Open the XML Sitemap Generator to build a sitemap from a URL list. Choose Paste multiple URLs, enter one address per line, and click Add All URLs. Review the generated entries. The tool exposes priority and change-frequency fields, but Google ignores those fields; increasing priority is not a ranking or crawl-speed setting.

3. Publish through your site’s normal deployment method

Download sitemap.xml and publish it at a stable public URL. Do not overwrite an automatically maintained CMS sitemap with a static file unless you deliberately intend to maintain the replacement. For WordPress, first find your WordPress sitemap and active robots.txt source.

Validate before submitting

  1. Open the sitemap URL and confirm HTTP 200 with actual XML, not an HTML error or browser challenge.
  2. Check the XML namespace, closing tags and URL escaping. An ampersand in a URL must be encoded as &amp; in XML.
  3. Open representative listed URLs. Confirm final destinations, canonical tags and absence of unwanted noindex directives.
  4. Keep each sitemap within 50,000 URLs and 50 MB uncompressed. Split larger lists and reference them from a sitemap index.
  5. Confirm any child sitemaps in an index also load. Submitting an index that references broken files does not repair those files.
  6. Use honest last-modified dates and retain ordinary internal links to the listed pages.

Use the Meta Tag Analyzer to review page-level indexing signals; inspect HTTP headers separately for X-Robots-Tag. Then add a sitemap directive to robots.txt using the full sitemap URL.

How to submit your sitemap to Google

  1. Open Google Search Console and select your property.
  2. In the left menu, go to Sitemaps.
  3. Enter the sitemap URL or the path requested by the selected property’s interface (e.g. https://example.com/sitemap.xml) and click Submit.
  4. Wait for the status to read Success — Google will report how many URLs it discovered.

You don’t need to resubmit every time you publish; search engines re-fetch known sitemaps on their own schedule. Submit once, then monitor fetch errors and URL coverage as you publish or remove content.

Link your sitemap from robots.txt

Beyond Search Console, the other standard way to advertise your sitemap is a single line in your robots.txt file. Every major crawler reads it:

robots.txt

User-agent: *
Allow: /

Sitemap: https://example.com/sitemap.xml

This is the belt-and-suspenders approach: the Sitemap: directive means bots that never touch Search Console (Bing, DuckDuckGo, and AI crawlers) still find your sitemap. If you don’t have a robots.txt yet, our Robots.txt Generator can create one with the sitemap line already included. For the full breakdown, see our complete robots.txt guide.

Troubleshoot sitemap and indexing reports

“Couldn’t fetch” or an HTML response

Check the exact submitted address, response status, redirect destination and public accessibility. Confirm that a login, firewall or challenge is not replacing the XML. A successful browser load does not prove Google receives the same response; hosting logs can help establish the difference.

“Success” but some pages are not indexed

Success means Google processed the sitemap; it is not approval of every page. Inspect an affected URL and distinguish “Discovered — currently not indexed” from “Crawled — currently not indexed.” The first says Google knows the URL but has not yet crawled it; the second says a crawl occurred without indexing. Neither status alone identifies the underlying cause.

Submitted and indexed counts differ

Review representative URLs for duplicates, alternate canonicals, noindex directives, soft errors and weak internal discovery. Assess whether the content offers useful, distinct information. Correct the actual issue, update links or sitemap entries when needed, and monitor later processing. Repeatedly submitting an unchanged sitemap is not a fix.

A migration leaves old URLs behind

Regenerate the sitemap with final URLs, check redirects from old pages, update internal links and submit the current index. Avoid simultaneously listing old redirects and their replacements as canonical pages.

Common sitemap mistakes

  • Listing non-canonical or redirected URLs. Only include the final, indexable version of each page. Never list URLs that 301/302 or 404.
  • Including noindexed pages. If a page is noindex, keep it out of the sitemap — mixing signals confuses crawlers.
  • Blocking the sitemap in robots.txt. Make sure you haven’t accidentally disallowed the path the sitemap lives on.
  • Stale lastmod dates. Use the date of the last significant content change. An unchanged page can correctly keep the same date; do not refresh every date merely because the sitemap was regenerated. Omit the field if you cannot keep it accurate.
  • Forgetting to update after a migration. After changing domains or URL structures, regenerate and resubmit.

Sitemaps vs robots.txt: what does what

These two files are often confused, but they do opposite jobs:

  • The sitemap says “here’s what I want you to crawl.” It’s an invitation.
  • robots.txt says “here’s what I don’t want you to crawl.” It’s a boundary.

Used together, they give search engines a clear map plus clear no-go zones. Neither one forces indexing — that’s still Google’s call — but together they make its job far easier.

The bottom line

An XML sitemap won’t magically boost your rankings, but it provides a discovery signal for pages that may otherwise be hard to find. Publish one, keep it clean (indexable, canonical URLs only), reference it from robots.txt, and submit it once in Search Console. Then get back to the work that actually moves rankings — great content and links.

Frequently asked questions

Where should my sitemap be located?

At the root of your domain, typically https://yoursite.com/sitemap.xml. It can technically live elsewhere if you submit it directly in Search Console, but the root is the convention every crawler expects.

How often should I update my sitemap?

If it’s generated automatically (WordPress, Shopify, most SEO plugins), it updates itself whenever you publish. For a hand-built file, regenerate it whenever you add or remove pages. You don’t need to resubmit each time — search engines re-crawl known sitemaps on their own.

What’s the maximum size of a sitemap?

50,000 URLs or 50 MB uncompressed per file, whichever comes first. Beyond that, split your URLs across multiple sitemaps and reference them from a single sitemap index file.

Do I need both an XML sitemap and a robots.txt?

Not every site needs both, and neither guarantees indexing. They do different jobs. The sitemap lists pages you want crawled; robots.txt sets rules for what shouldn’t be crawled. Adding a Sitemap: line to robots.txt is the best-practice way to link the two.

Will a sitemap improve my Google rankings?

Not directly. A sitemap helps Google discover and crawl your pages faster and more completely, which is a prerequisite for ranking — but the ranking itself still depends on content quality, relevance and links.

Should I include images and videos in my sitemap?

You can, using the image and video sitemap extensions, if visual content is important to your traffic (e.g. a photography or recipe site). For most sites the standard URL sitemap is enough.

Related tools & guides

Reference documentation

Consult Google’s sitemap creation guidance and the Sitemaps XML protocol for limits, fields and escaping requirements.

Editorial note: Updated September 29, 2026 with AI assistance. Instructions were reviewed against the relevant tool implementation and documentation; examples are illustrative rather than claims of personal experience.

Written by

ToolBrainy Editorial Team

ToolBrainy publishes guides to its PDF, image, calculator, security, and developer tools. Our guides explain practical steps, examples, and limitations. Check any editorial notes for how a guide was prepared, and contact us if a step or result needs correction.

Handy tools for this topic

Free online tools, no signup

Every ToolBrainy tool runs right in your browser — no accounts, no watermarks and no limits. Compress a PDF, generate a strong password, convert an image and plenty more.

Browse all tools