XML Sitemaps Explained: How to Create and Submit One
TL;DR
An XML sitemap helps search engines find your pages faster. Learn what a sitemap is, how to create one, how to submit it to Google and Bing, and best practices.
Search engines are constantly crawling the web, looking for new and updated pages. But they don't always find everything on their own. If your site has hundreds (or thousands) of pages, some of them might get missed entirely. That's where an XML sitemap comes in.
An XML sitemap is one of the most basic things you can do for your site's SEO, yet plenty of websites still don't have one. This guide covers what a sitemap is, how the XML structure works, how to create one, and how to submit it to Google and Bing so your pages get found faster.
What Is an XML Sitemap?
An XML sitemap is a file, usually named sitemap.xml, that lists all the important URLs on your website. It's written in XML format and designed specifically for search engine crawlers like Googlebot and Bingbot. Think of it as a map you hand directly to search engines, saying "here's everything I want you to know about."
It doesn't guarantee indexing. Google will still decide whether a page is worth including in search results. But a sitemap makes discovery much faster, especially for new pages, pages buried deep in your site structure, or pages with few internal links pointing to them.
Your sitemap lives at the root of your domain:
https://yourdomain.com/sitemap.xml
You can check whether you already have one by typing that URL into your browser right now.
Try XML Sitemap Validator Free
Validate your XML sitemap for errors.
Open ToolNo signup required. Runs in your browser.
Why XML Sitemaps Matter for SEO
Without a sitemap, search engines rely entirely on crawling links to discover your pages. If a page is three or four clicks deep from your homepage, and nothing links to it prominently, crawlers might never reach it. Or they might take weeks to find it.
A sitemap solves this. It gives crawlers a direct list of every page you care about. That helps with:
- Faster discovery of new content you publish
- Re-crawling pages you've recently updated
- Finding orphan pages (pages with no internal links)
- Communicating which pages you consider most important
- Helping search engines understand your site's overall structure
Large sites benefit the most. If you run an ecommerce store with thousands of product pages, or a blog with years of archived posts, a sitemap is essential. But even small sites benefit from having one. It takes minutes to set up and costs nothing.
XML Sitemap Structure and Syntax
A sitemap.xml file follows a strict XML format. Here's what a basic one looks like:
<?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-04-10</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://yourdomain.com/about</loc>
<lastmod>2026-03-15</lastmod>
<changefreq>monthly</changefreq>
<priority>0.6</priority>
</url>
</urlset>
The root element is <urlset>, and each page is wrapped in a <url> block. Inside that block, you have four possible tags.
Required Tag
<loc> is the only required tag. It contains the full, absolute URL of the page. Always include the protocol (https://).
Optional Tags
<lastmod> tells search engines when the page was last modified. Use the W3C date format: YYYY-MM-DD. Only set this to the actual date of the last meaningful change.
<changefreq> suggests how often the page typically changes. Values include always, hourly, daily, weekly, monthly, yearly, and never. Google has said it largely ignores this tag.
<priority> is a value from 0.0 to 1.0 indicating how important a page is relative to other pages on your site. Google also mostly ignores this one.
The honest truth: <loc> and <lastmod> are the only tags that really matter in practice.
How to Create a Sitemap
You've got three main options, depending on your setup.
CMS Plugins
If your site runs on WordPress, the Yoast SEO or Rank Math plugins generate sitemaps automatically. Shopify creates one by default at /sitemap.xml. Most modern CMS platforms handle this for you.
Online Generators
If your CMS doesn't handle sitemaps, or you want more control, an XML sitemap generator will crawl your site and produce the file for you.
Manual Creation
For small sites with fewer than 50 pages, you can write a sitemap by hand. Use the XML structure shown above, add each URL as a <url> block, and save the file as sitemap.xml.
How to Submit Your Sitemap to Google
Creating the file is half the job. You also need to tell search engines where to find it.
Google Search Console
- Sign in to Google Search Console
- Select your property (your website)
- Click "Sitemaps" in the left sidebar under "Indexing"
- Enter the full URL of your sitemap
- Click "Submit"
Bing Webmaster Tools
The process for Bing is similar. Sign in, select your site, go to "Sitemaps", and submit.
Adding Your Sitemap to robots.txt
You should also reference your sitemap in your robots.txt file:
Sitemap: https://yourdomain.com/sitemap.xml
If you don't have a robots.txt file yet, Morphkit's Robots.txt Generator can create one with the sitemap reference included.
Sitemap Best Practices
Stay under the limits. A single sitemap can contain a maximum of 50,000 URLs and must be no larger than 50MB.
Split large sitemaps. If you have more than 50,000 URLs, break them into multiple sitemap files and use a sitemap index file.
Only include canonical URLs. Don't add pages that redirect, return 404 errors, or have a noindex tag.
Keep it updated. A stale sitemap with outdated lastmod dates or dead URLs signals neglect to search engines.
Use HTTPS URLs. Make sure every URL in your sitemap uses https://.
How to Validate Your Sitemap
Before submitting your sitemap to any search engine, validate it. Morphkit's free XML Sitemap Validator checks your sitemap for XML syntax errors, verifies that URLs are properly formatted, and flags common issues. No signup, no limits.
Get Your Sitemap Right
An XML sitemap is a small file that does a lot of work. Create your sitemap, validate it with the free XML Sitemap Validator on Morphkit, submit it to Google and Bing, and reference it in your robots.txt.
Try it yourself
Try XML Sitemap Validator →