How to create and submit a sitemap
What a sitemap actually does, how to build a valid one, and where to submit it once it exists.
A sitemap is a plain XML file that lists the URLs on your site you consider worth crawling, along with a couple of optional hints about each one. It is not a design document and nobody but a crawler reads it. Its entire job is to answer one question search engines otherwise have to work out for themselves: what pages exist here?
For a five-page brochure site this barely matters — a crawler will find every page by following your own navigation. For anything larger, a section that is not fully linked, or a site that has just changed its structure, a sitemap removes the guesswork.
What a valid sitemap looks like
The format is defined by the sitemaps.org protocol and it is intentionally simple: an XML file with one <url> entry per page.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://yourdomain.com/</loc>
<lastmod>2026-08-20</lastmod>
</url>
<url>
<loc>https://yourdomain.com/about-us</loc>
<lastmod>2026-07-11</lastmod>
</url>
</urlset>
loc is the only field that has to be right, and it has to be the full, canonical URL — including https:// and matching whichever version of your domain (with or without www) you actually serve. lastmod is optional but worth including where you can generate it accurately; a date that never changes across every page is worse than leaving it out, because it tells a crawler nothing useful.
| Limit | Value |
|---|---|
| Maximum URLs per sitemap file | 50,000 |
| Maximum uncompressed file size | 50MB |
| Over either limit | Split into multiple sitemaps, listed in a sitemap index file |
Generating one without hand-writing XML
Almost nobody writes this file by hand. If your site runs on a CMS, an SEO plugin will generate and maintain the sitemap automatically, regenerating it whenever a page is published, updated or removed — which is also why a plugin-generated sitemap is more reliable than a manually built one that quietly falls out of date. If you are running a static or hand-coded site, a number of free online generators will crawl your own site and produce a valid file, or you can write a short script that lists your pages if the structure is simple and predictable.
A sitemap stuffed with admin URLs, tag archives, search result pages, or near-duplicate pages does not help indexing — it can actively work against it, by signalling that a meaningful share of the site is low-value. Before submitting, open the file and sanity-check what is actually in it. If your CMS is including things it should not, that is usually a plugin setting rather than something to fix by hand.
Where the file has to live
Convention — and what every crawler expects — is yourdomain.com/sitemap.xml, at the root of the site, not inside a subfolder. A sitemap can technically only reference URLs at or below the location it is hosted from, so a root-level sitemap can cover the whole domain while one buried in a subfolder cannot.
Upload it through your control panel's file manager if your CMS or plugin has not already placed it there for you.
Point to it from robots.txt
Add a single line near the top or bottom of your robots.txt file:
Sitemap: https://yourdomain.com/sitemap.xml
This is how crawlers that have never been told about your sitemap directly — Bing's among them — can still discover it during a routine crawl. See how to write a robots.txt file for the rest of that file's syntax.
Submitting it properly
Referencing the sitemap in robots.txt is enough for a crawler to eventually find it, but submitting it directly in each search engine's own tool is faster and gives you feedback.
- Google Search Console. Under Sitemaps, enter just the filename (
sitemap.xml) against your verified property and submit. The Status column will move from "Pending" to a processed result within a day or so; if it stays stuck or shows an error, that error message tells you exactly what failed. - Bing Webmaster Tools. The same idea under its own Sitemaps section. Bing's index is smaller than Google's but it also powers other surfaces, and submitting here costs nothing extra once you have already built the file.
See setting up Google Search Console if you have not verified your property yet — a sitemap cannot be submitted anywhere until that step is done.
Reading the result without over-interpreting it
Search Console will report how many URLs in the sitemap were discovered and, separately, how many were indexed. A gap between those two numbers is completely normal and not automatically a problem — indexing is a judgement Google makes about each page's value, and a sitemap entry is a request to be considered, not a guarantee. If a large share of a genuinely useful section is not being indexed, that is worth investigating as a content or duplication question rather than a sitemap one; see fixing duplicate content for the most common cause.
Once submitted, a sitemap that regenerates automatically needs no further attention. Resubmitting after every content change is unnecessary — crawlers revisit a known sitemap on their own schedule.
Frequently asked questions
Do I need a sitemap for a small site?
Less than you would think. If every page is reachable through normal navigation links, Google can usually find them without one. A sitemap earns its keep once a site has more pages than a visitor would casually click through, or a section that is not fully linked internally.
How often should I update my sitemap?
It should regenerate automatically whenever you add or remove a page — most CMS plugins do this without any action from you. A sitemap that is manually maintained and quietly goes stale is worse than no sitemap, because it starts listing pages that no longer exist.
What is the maximum size of a sitemap file?
The sitemap protocol caps a single file at 50,000 URLs and 50MB uncompressed. A site larger than that needs a sitemap index file that points to several smaller sitemaps rather than one that breaks the limit.
Related reading
A new site is invisible until Google has crawled and indexed it. Here is how to remove the obstacles and ask directly.
How to write a robots.txt fileThe syntax, the common mistakes, and the one thing robots.txt cannot do no matter how you write it.
How to set up Google Search ConsoleVerifying a site takes minutes. Here is the fastest verification method for your setup and what to look at once you are in.
What is a canonical tag?A line in the page head that tells search engines which of several similar URLs is the one that should actually be indexed.