Uttir
By Uttir 7 min read

How to Create an XML Sitemap (and Why You Need One)

A sitemap.xml file tells search engines which pages on your site exist. Learn what to include, what to leave out, how to write one by hand or generate one, and how to submit it to Google and Bing.

A sitemap.xml is a file at the root of your site (yourdomain.com/sitemap.xml) that lists every page you want search engines to index, with optional metadata like when each page was last updated and how important it is relative to other pages. The format is strict XML, and the file must be reachable at the URL you submit to Google Search Console. The Uttir Sitemap Generator builds one from a list of URLs in under a minute.

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/about is valid. /about is 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/about and /de/about as separate URLs, or as hreflang alternates — see below)

Exclude

  • Pages with noindex meta 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 static site generators (Hugo, Jekyll, Next.js with next-sitemap, Astro, SvelteKit with adapter-static and a custom plugin) have a sitemap plugin or example. 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

  1. Verify your site in Google Search Console if you have not already.
  2. Go to Sitemaps in the left sidebar.
  3. Enter the URL of your sitemap (usually sitemap.xml) in the "Add a new sitemap" field.
  4. 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.

Common questions

Do I need a sitemap for a small site?

It does not hurt. A sitemap with 10 URLs is not going to help or hurt your rankings, but it removes any "Google missed a page" risk. For a brand new site, submitting a sitemap is one of the first things to do after launch.

What if my sitemap has errors?

Google Search Console will show you the errors. Common issues: invalid XML (missing closing tag, special characters not encoded), URLs with noindex, URLs that 404, URLs blocked by robots.txt. Fix the source of the error, regenerate, and resubmit.

Does a sitemap help with rankings?

Indirectly. The sitemap itself is not a ranking factor. But the discovery speed and crawl coverage it enables mean your pages get indexed faster and more reliably, which means they can start ranking sooner. The difference is most visible on new sites or sites with deep hierarchies.

Can I have multiple sitemaps?

Yes. The sitemap index file (above) lets you reference multiple sitemap files from one master sitemap. Useful for large sites or sites that want to split sitemaps by content type.

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.

#seo#sitemap#xml#search-engine-optimization#developer-tools

New tools and guides, once a week

One short email when something new ships. No tracking, no images, unsubscribe with one click.