How-To Guide

How to Create an XML Sitemap

An XML sitemap is a file that lists the important pages on your site, helping search engines discover and index them efficiently. It is especially valuable for large sites, new sites with few backlinks, and pages that are not well linked internally. This guide explains how to create, optimize, and submit an XML sitemap.

4 steps

Step-by-Step

  1. 1

    Decide which pages to include

    Include canonical, indexable pages you want ranked. Exclude noindex pages, duplicates, redirects, and low-value URLs so the sitemap reflects only the content you want search engines to prioritize.

  2. 2

    Generate the sitemap file

    Use a sitemap generator or your CMS to produce a valid XML file with each URL, and optionally a last-modified date. Keep it under the limits of 50,000 URLs and 50MB per file.

  3. 3

    Add it to robots.txt and host it

    Place the sitemap at a stable URL, typically /sitemap.xml, and reference it in your robots.txt so crawlers can find it automatically.

  4. 4

    Submit and monitor in Search Console

    Submit the sitemap in Google Search Console and check the coverage report for errors, then keep it updated as you add or remove pages.

What an XML Sitemap Does

An XML sitemap is a roadmap that tells search engines which pages on your site you consider important and want indexed. While search engines can discover pages by following links, a sitemap ensures nothing important is missed, which matters most for large sites, sites with deep or poorly linked pages, and new sites that have few external links pointing to them.

A sitemap does not guarantee indexing; it is a strong hint, not a command. Google still decides what to index based on quality and relevance. But by listing your canonical, valuable pages and their update dates, a clean sitemap helps search engines crawl more efficiently and discover new and updated content faster, which is why it is a foundational piece of technical SEO.

What to Include and Exclude

A sitemap should list only the canonical, indexable pages you want to rank. Include your important content pages and ensure each URL is the canonical version. Exclude pages you have set to noindex, duplicate or parameterized URLs, redirected URLs, and thin or utility pages that add no search value. A sitemap full of low-value or non-indexable URLs dilutes the signal and wastes crawl attention.

Keep within the technical limits: a single sitemap file can hold up to 50,000 URLs and be no larger than 50MB uncompressed. Larger sites split content across multiple sitemaps referenced by a sitemap index file, often grouped by type such as pages, blog posts, and products. This structure keeps each file manageable and makes coverage issues easier to diagnose in Search Console.

Submitting and Maintaining Your Sitemap

Once your sitemap is hosted at a stable URL and referenced in robots.txt, submit it in Google Search Console and Bing Webmaster Tools. Search Console then reports how many submitted URLs are indexed and flags errors, giving you a direct view of discovery and indexing problems to fix.

A sitemap is only useful if it stays current. As you publish, update, or remove pages, the sitemap must reflect those changes, ideally automatically, or it will point crawlers at stale or missing URLs. Many CMSs and publishing systems regenerate the sitemap dynamically so new content is included the moment it goes live. Keeping the sitemap accurate ensures the pages you publish are discovered and indexed promptly rather than waiting to be found through links.

Frequently Asked Questions

Let GrandRanker Do This for You

Generate a valid sitemap in seconds with our free tool, and keep publishing content worth indexing. GrandRanker ships fresh, optimized pages on a schedule so your sitemap always has new content to surface.