A sitemap.xml is a file that lists every page on your website you want search engines to find, in a format they can read in seconds. It does not guarantee Google will index your pages — but without one, Google has to discover them by following links, and pages with few links may never be found at all.
This guide shows you how to create a sitemap.xml for your website from scratch: how to check whether you already have one, how to generate one for free, how to upload it, and how to submit it to Google Search Console. It also covers what to leave out, because a sitemap full of junk pages is worse than a short, clean one.

First, Check Whether You Already Have a Sitemap
Before you create anything, check. Many sites already have a sitemap they do not know about — WordPress has generated one automatically since version 5.5, and most SEO plugins generate one too.
Visit yoursite.com/sitemap.xml in your browser. If you see an XML file listing your pages (or a sitemap index linking to several sitemaps), you already have one — skip ahead to the submission section. Also try yoursite.com/wp-sitemap.xml (WordPress’s built-in sitemap) and yoursite.com/sitemap_index.xml (the format Rank Math and Yoast use).
If all three return a 404, you need to create one. If one of them works, check that it actually lists your pages: open it, click through a few URLs, and make sure the list is current. A sitemap that lists pages you deleted years ago is not helping anyone.
How to Create a Sitemap.xml for Your Website: 4 Methods
1. With a WordPress SEO plugin (easiest)
If your site runs WordPress with Rank Math or Yoast SEO, your sitemap already exists — the plugin generates and updates it automatically. In Rank Math, go to Rank Math > Sitemap Settings to see it and to choose which post types and taxonomies to include. In Yoast, go to SEO > Settings > Site features and make sure “XML sitemaps” is on. The sitemap updates itself whenever you publish or delete a page, so this is the only method that needs no maintenance.
2. With an online generator (best for small static sites)
For a site without a CMS, use a generator: enter your domain, and it crawls your site and builds the file. Our sitemap XML generator builds one from a list of URLs you paste in — useful when you want control over exactly which pages are included, rather than trusting a crawler to find them all. Other free generators (XML-Sitemaps.com and Screaming Frog’s free version, which crawls up to 500 URLs) work the same way.
Whichever generator you use, review the output before uploading it. Generators find what is linked; they miss orphan pages (pages nothing links to) and they include pages you may not want — tag archives, author pages, and duplicate URLs with tracking parameters.
3. By hand (best for tiny sites)
For a site with a handful of pages, writing the file by hand takes ten minutes. A sitemap is just XML: a <urlset> wrapper, and one <url> block per page with its address and last-modified date.
<?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-11-18</lastmod>
</url>
<url>
<loc>https://example.com/about/</loc>
<lastmod>2026-11-10</lastmod>
</url>
</urlset>
Only <loc> is required. <lastmod> is worth including — Google uses it to decide when to re-crawl a page. The <priority> and <changefreq> tags are optional, and Google has said it ignores them, so leave them out.
4. With a script or build step (best for large or dynamic sites)
If your site has thousands of pages, or pages generated from a database, generate the sitemap as part of your build or deployment. Most frameworks have a plugin for it — Next.js has next-sitemap, Django has a sitemaps framework, and static generators like Hugo and Jekyll have sitemap templates built in. The sitemap is rebuilt on every deploy, so it never goes stale.

What to Include (and What to Leave Out)
A sitemap should list every page you want indexed, and nothing else. That sounds obvious, but most sitemaps are full of pages that should not be there.
Include: your homepage, every published post and page, your main category and tag pages (if they are useful landing pages), and any landing pages you want in search results. Include image and video URLs if your content depends on them — Google supports image and video sitemap extensions for that.
Leave out: pages blocked by robots.txt (a URL in both your sitemap and your robots.txt disallow list sends Google a contradictory message), pages with a noindex tag, redirect URLs, 404 pages, duplicate URLs (the same page with and without a trailing slash, or with tracking parameters), login and admin pages, and thin pages with no real content. If you have a robots.txt file, our guide to creating a robots.txt file explains how the two files work together.
The technical limits are generous: a single sitemap can hold 50,000 URLs and be up to 50 MB uncompressed. If your site is larger than that, split it into several sitemaps and list them in a sitemap index file — which is what WordPress SEO plugins do automatically.
How to Submit Your Sitemap to Google Search Console
Creating the file is only half the job. You also need to tell Google it exists, and the way to do that is Search Console.
- Upload the sitemap to your site root, so it is reachable at yoursite.com/sitemap.xml. For WordPress, the plugin handles this. For a static site, put the file in your published folder and deploy.
- Open Google Search Console and select your property. If you have not added your site yet, do that first — you will need to verify ownership, usually with a DNS record or an HTML file.
- Go to Sitemaps in the left menu, enter the sitemap URL (just the filename, e.g. sitemap.xml), and click Submit.
- Wait. Search Console will show the sitemap’s status — “Success” means Google fetched and read it. The “Discovered pages” count tells you how many URLs Google found in it.
Also add the sitemap to your robots.txt file, so crawlers that do not use Search Console can find it: one line at the end of the file, Sitemap: https://yoursite.com/sitemap.xml. And submit it to Bing Webmaster Tools too — Bing powers several other search engines, and the submission takes a minute.
One honest note: submitting a sitemap does not make Google index your pages. It tells Google which pages exist and invites a crawl. Whether a page gets indexed depends on its content, its links, and Google’s judgement — which is why the quality of your pages matters more than the quality of your sitemap.

How to Check Whether Your Sitemap Is Working
After submitting, check three things in Search Console:
- Status: the sitemap should show “Success”. If it shows “Couldn’t fetch”, the URL is wrong or the file is not reachable — check it in your browser.
- Discovered pages: the count should roughly match the number of URLs in your file. If it is much lower, some URLs may be duplicates or blocked.
- Coverage: go to the Pages report and look at how many of your sitemap URLs are indexed. A sitemap URL that stays “Discovered — currently not indexed” for months is a sign the page needs better content or better internal links, not a better sitemap.
Re-check after any big site change — a redesign, a migration, or a bulk delete. Sitemaps go stale silently, and a stale sitemap wastes Google’s crawl budget on pages that no longer exist.

How to Create a Sitemap.xml for Your Website: Frequently Asked Questions
Do I need a sitemap.xml?
Small sites with good internal linking can be crawled without one. But a sitemap costs nothing to create, helps Google find new and orphaned pages faster, and gives you a coverage report in Search Console. There is no downside to having one.
How often should I update my sitemap?
Whenever your pages change. If you use a WordPress SEO plugin or a build-step generator, it updates automatically. If you generate it by hand or with an online tool, regenerate it after publishing or deleting pages — at least monthly for an active site.
Can a sitemap hurt my SEO?
Only if it is full of junk: 404s, redirects, noindex pages, and duplicates waste crawl budget and send Google mixed signals. A clean sitemap with only your real, indexable pages cannot hurt you.
What is a sitemap index?
A sitemap index is a file that lists other sitemaps. Large sites split their URLs across several sitemaps (one for posts, one for pages, one for products) and list them all in an index file, usually called sitemap_index.xml. You submit the index to Search Console, and Google reads the sitemaps it points to.