How to Create an XML Sitemap (and Why You Need One)
Learn what an XML sitemap does, which URLs to include or exclude, protocol size limits, and how to generate and submit one to search engines.
An XML sitemap at /sitemap.xml lists canonical public URLs you want search engines to crawl, using strict <urlset> XML capped at 50,000 URLs or 50 MB per file. Build one locally with the Sitemap Generator and submit it in Search Console.
An XML sitemap is a single file at the root of your site that lists every page you want search engines to find. It does not guarantee that Google will index every URL (Google can ignore pages it considers low quality), but it removes the "Google has to discover the page by following links" step and makes sure nothing important is missed.
This guide is the practical version: what to include, what to leave out, how the file format works, and how to generate one. If you just want to make one, the Uttir Sitemap Generator builds a valid sitemap.xml from a list of URLs in your browser, with no upload.
What a sitemap actually does
Without a sitemap, search engines discover pages by following links from one page to another. For a new site, or a site with pages that are not well-linked from the home page, discovery is slow and unreliable. A sitemap hands the search engine the list of pages you want indexed, with metadata about each one. It does not force indexing, but it does ensure the search engine knows the page exists.
For most small sites, a sitemap is a useful "make sure nothing is missed" tool. For large sites (10,000+ URLs, or sites with deep hierarchies), a sitemap is essential because the crawler will not reach every page by following links alone.
The structure of a sitemap
A sitemap.xml is a strict XML file. The minimum valid sitemap looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
</url>
<url>
<loc>https://example.com/about</loc>
</url>
</urlset>
Each <url> block describes one page. The <loc> (location) tag is the only required field inside it. The whole file is wrapped in a <urlset> element with the correct namespace.
Optional but useful fields
Three optional fields give search engines more information about each URL. None of them are guaranteed to be respected, but they help:
lastmod
When the page was last updated, in ISO 8601 format (e.g. 2026-08-15). Search engines use this as a hint about how often to recrawl. Use the date the content actually changed, not the date the page was generated.
changefreq
How often the page is likely to change. Values: always, hourly, daily, weekly, monthly, yearly, never. Google has said they mostly ignore this, but it is still part of the spec. Use it for documentation purposes if nothing else.
priority
A hint, from 0.0 to 1.0, of how important this URL is relative to other URLs on your site. The default is 0.5. Setting the home page to 1.0 and the rest to 0.8 is common. Google has said they ignore this. Most sitemap generators still include it because some smaller search engines do use it.
The hard limits
The sitemap protocol has three limits you need to know:
- Maximum 50,000 URLs per sitemap file. If you have more, split into multiple sitemaps and use a sitemap index file (see below).
- Maximum 50 MB per file (uncompressed). For very large sites, split the files or compress with gzip.
- URLs must be absolute, with the protocol.
https://example.com/aboutis valid./aboutis not. Use the URL encoder if your URLs contain special characters that need to be percent-encoded.
Sitemap index files for large sites
If you have more than 50,000 URLs, you split them into multiple sitemap files and reference them in a sitemap index file. The index file is at yourdomain.com/sitemap.xml and the individual files have any name you want (e.g. sitemap-1.xml, sitemap-2.xml):
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-1.xml</loc>
<lastmod>2026-08-15</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-2.xml</loc>
<lastmod>2026-08-15</lastmod>
</sitemap>
</sitemapindex>
You can also have multiple sitemap types: one for HTML pages, one for images, one for news articles. Each is a separate sitemap file referenced from the index. Most sites do not need this, but it is the right structure for very large sites.
What to include and what to leave out
The most common sitemap mistake is including URLs that should not be indexed. Here is the rule: include every URL you want a search engine to know about, and exclude everything else.
Include
- Every public page (home, about, contact, blog posts, product pages, tool pages, etc.)
- Localized versions of pages (e.g.
/en/aboutand/de/aboutas separate URLs, or as hreflang alternates — see below)
Exclude
- Pages with
noindexmeta tag - Pages blocked by robots.txt
- Paginated versions (use the canonical tag to point to the first page, and exclude the rest)
- Internal search results pages
- Admin or staging URLs that are not public
- Duplicate URLs (consolidate with canonical tags first)
- Pages with parameters that do not change content (use canonical tags to point to the canonical version)
The exception: if a page is noindex but you still want the search engine to know it exists (so it can find the canonical), it can stay in the sitemap. But the common case is "noindex = do not list it".
How to create a sitemap for your site
For small sites (under a few hundred pages), the manual approach works. For larger sites, generate it.
Manual approach
For a static site, the sitemap is usually generated at build time. Most popular static-site frameworks ship a sitemap plugin or a small example you can copy; check your framework's documentation. The sitemap lives at /sitemap.xml after the build and is served as a static file.
Generator approach
For a site that does not have build-time generation (a CMS, a hand-coded site, a one-off project), the Uttir Sitemap Generator builds a valid sitemap.xml from a list of URLs. Paste your URLs (one per line), set the lastmod and changefreq if you want, and copy the result. The whole file is generated in your browser, so the URLs never leave your device.
WordPress and CMS approach
WordPress plugins like Yoast SEO, Rank Math, and All in One SEO generate sitemaps automatically. For other CMSes, there is usually an extension or a script that scans the database and writes a sitemap file.
How to submit a sitemap to search engines
Creating the file is half the work. The other half is telling search engines where it is.
Google Search Console
- Verify your site in Google Search Console if you have not already.
- Go to Sitemaps in the left sidebar.
- Enter the URL of your sitemap (usually
sitemap.xml) in the "Add a new sitemap" field. - Click Submit.
Google will show you how many URLs it found and how many it indexed. If the number indexed is much smaller than the number submitted, that is a sign that some URLs are blocked by robots.txt, marked noindex, or have other issues.
Bing Webmaster Tools
The same idea, different console. Submit at Bing Webmaster Tools under Sitemaps.
robots.txt reference
You can also point to your sitemap from your robots.txt file. This is optional but a good practice — it gives crawlers a hint even before they discover the sitemap URL:
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap.xml
The Uttir Robots.txt Generator produces a valid robots.txt that includes the Sitemap directive.
How often to update the sitemap
For most sites, regenerating the sitemap at build time is enough. The sitemap changes whenever you add, remove, or significantly update a page. The lastmod field tells search engines which URLs to recrawl first.
Common cadences:
- Static site with a build step: regenerate on every build (automatic)
- Blog: regenerate when you publish a new post
- E-commerce: regenerate daily or on product changes
- News site: real-time, with a separate news sitemap
Search engines will re-fetch the sitemap periodically on their own. You do not need to ping them on every change.
Sitemaps and large-scale SEO
A few patterns that matter at scale:
- Sitemap for images. If your site has images that should be indexed, use the image sitemap extension. Google Images uses it as a discovery source.
- Sitemap for news. If you run a news site, the Google News sitemap protocol is the right format. Required to appear in Google News.
- hreflang in sitemaps. For multilingual sites, you can declare language alternates in the sitemap instead of in
<link>tags. Cleaner for large sites with hundreds of pages per language.
For most small sites, the basic sitemap format is enough.
Bottom line
An XML sitemap is the simplest SEO infrastructure: a single file, a strict format, free to generate. The Uttir Sitemap Generator builds one from your URL list in your browser. Submit it to Google Search Console and Bing Webmaster Tools, and reference it in your robots.txt. That is the whole setup.
Further reading
Primary source: Sitemaps.org — Sitemaps XML protocol specification.
Frequently asked questions
- Do small websites still benefit from an XML sitemap?
- Yes. Even a 10-page site benefits from submitting a sitemap because it helps search engines discover new or updated URLs without waiting on external links.
- What causes most XML sitemap validation errors in Search Console?
- Common causes include unescaped XML characters in URLs, relative paths instead of full
https://URLs, or listing URLs that return 404, redirect, or carrynoindex. - When do I need a sitemap index file instead of one sitemap.xml?
- A single sitemap file is capped at 50,000 URLs and 50 MB uncompressed. Beyond either limit—or to separate blog, product, and localized pages—split into multiple files referenced by a
<sitemapindex>.