Nov
10

How to Create and Submit an XML Sitemap

11/10/2026 12:00 AM

Last updated: November 2026

A new website can have excellent pages and still be slow to appear in Google, simply because Google has not found them yet. An XML sitemap helps with this. It is a list of the pages that you want search engines to know about. This guide explains what a sitemap is, how to create one, how to submit it to Google, and which mistakes to avoid.

What Is an XML Sitemap?

An XML sitemap is a file that lists the important addresses (URLs) of your website. Search engines read it to discover pages and to see when they were last changed. It is usually found at an address like https://www.example.com/sitemap.xml.

A very small sitemap looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2026-11-01</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/contact</loc>
  </url>
</urlset>

Each page is one url entry. Only the loc tag, which holds the address, is required. The lastmod tag is optional and shows the date when the page was last changed.

Do You Need a Sitemap?

Google can find most pages by following links, so a sitemap is not required. It helps most when:

  • Your website is new and has few links from other sites.
  • Your website is large, with many pages.
  • Some pages are not linked well from other pages on your site.
  • You publish new pages often.

A sitemap does not guarantee that a page will be indexed or ranked. It only helps search engines find it. Google still decides which pages are worth including.

What to Put in Your Sitemap

Include only pages that you want people to find in search results. Each address should:

  • return a normal 200 status, not an error or a redirect;
  • be the preferred (canonical) version of the page;
  • not carry a noindex tag;
  • use the same version of your domain every time, for example always https and always www, or always without www.

Leave out error pages, redirected addresses, duplicate pages, login pages, and internal search result pages.

About lastmod, changefreq, and priority

The sitemap standard also has changefreq and priority tags. Google mostly ignores both, so you do not need to spend time on them. The lastmod date can help, but only if it is honest. Change it when the content of the page really changes, not every time the file is generated.

How to Create a Sitemap

You have three common options:

  1. Let your CMS do it. WordPress creates a basic sitemap at /wp-sitemap.xml, and SEO plugins such as Yoast or Rank Math create their own. Most modern website builders also create one automatically.
  2. Use a generator. Our XML Sitemap Generator crawls your website and builds the file for you. Enter your domain, choose how many pages to crawl, and click Save As XML File.
  3. Write it by hand. This is fine for a site with a handful of pages. Use a plain text editor and follow the example above.

If you use a generator, upload the saved file to the root folder of your website, usually public_html, and name it sitemap.xml.

How to Submit Your Sitemap to Google

  1. Open Google Search Console and choose your website.
  2. Click Sitemaps in the left menu.
  3. Under "Add a new sitemap", type the part of the address after your domain, for example sitemap.xml.
  4. Click Submit.

After a short time the report shows a status. "Success" means that Google read the file. "Couldn't fetch" or "Has errors" means that something is wrong, and the report explains what.

Also Add It to Your Robots.txt File

Add one line to your robots.txt file with the full address of your sitemap:

Sitemap: https://www.example.com/sitemap.xml

This lets any search engine that reads your robots.txt find the sitemap. If you need help with that file, read our guide on what a robots.txt file is and how to create one. Google no longer supports the old method of "pinging" a sitemap address, so submitting in Search Console and listing it in robots.txt are the ways to go.

Check That Your Sitemap Works

  • Open the sitemap address in your browser. You should see XML text and not an error page.
  • Use our Server Status Checker to confirm that the sitemap returns a 200 status.
  • In Search Console, look at the Sitemaps report for the number of discovered pages and any errors.
  • Pick a few addresses from the file and open them to be sure that they work.

Common Sitemap Mistakes

  • Wrong domain version. A sitemap that lists non-www addresses on a site that uses www sends mixed signals. Keep them the same.
  • Listing pages that are blocked or noindexed. This contradicts your own instructions.
  • Listing redirected or broken addresses. They waste crawling time and make the report noisy.
  • Invalid XML. An ampersand (&) inside an address must be written as &amp;, and the file must be saved as UTF-8.
  • A file that is too big. One sitemap can hold up to 50,000 addresses or 50 MB uncompressed. Larger sites use several files and a sitemap index that lists them.
  • Never updating it. A sitemap made once and forgotten slowly becomes wrong. Use a method that updates it when you add or remove pages.

Other Kinds of Sitemaps

Besides the standard page sitemap, there are special sitemaps for images, videos, and news. They are optional and useful only if those content types are important for your site.

Frequently Asked Questions

How often should I update my sitemap?

Whenever you add, remove, or move pages. A CMS or plugin can do this automatically.

Does Bing use sitemaps too?

Yes. You can submit your sitemap in Bing Webmaster Tools as well.

Can I have more than one sitemap?

Yes. Large websites often use several, together with a sitemap index file.

Why is my sitemap submitted but my pages are not indexed?

A sitemap only helps Google find pages. Pages may still be left out if they are new, thin, duplicated, or blocked. Check them with the URL Inspection tool in Search Console.

Next Steps

Create your file with our XML Sitemap Generator, submit it in Search Console, and check once a month that the report shows no errors.