An XML sitemap is a file, usually at /sitemap.xml, that lists the URLs on your site you want search engines to find and index, with the date each page last changed. It does not make Google rank or even index a page, but it helps Google discover new and deep pages sooner and tells it which URLs you consider the real ones. This guide is for site owners and editors: it explains what goes in a sitemap and what stays out, how Google actually uses the file, whether your site needs one, and how to create, submit and check it, with links to the in-depth guide for each part.
Quick answer
- One entry per page you want indexed: the full, final, canonical URL that answers 200, plus an honest
<lastmod>date if you have one. - Leave out redirects, 404s,
noindexpages, duplicates that canonicalise elsewhere and URLs blocked in robots.txt. - Limits per file: 50,000 URLs and 50 MB uncompressed. Larger sites split the list and add a sitemap index.
- Google ignores
<priority>and<changefreq>and uses<lastmod>only when it is consistently accurate. - Declare it with
Sitemap: https://example.com/sitemap.xmlin robots.txt and submit it once in Google Search Console. - Most platforms build it for you: WordPress, Shopify, Wix, Squarespace and the SEO plugins all publish one automatically.
- Check yours with the free sitemap checker.
What is an XML sitemap?
An XML sitemap is a machine-readable list of a site's pages in the format defined by the sitemaps.org protocol, which Google, Yahoo and Microsoft agreed on in 2006 and which every major search engine still reads. It exists for crawlers, not for people: visitors never see it, and it has no design.
A minimal sitemap with two pages:
<?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-09-20</lastmod>
</url>
<url>
<loc>https://example.com/shoes/alpina-pro/</loc>
<lastmod>2026-09-24T09:15:00+02:00</lastmod>
</url>
</urlset>The elements, and what Google does with each:
| Element | Required | What it holds | |
|---|---|---|---|
<urlset> | Yes | The list, with the sitemaps.org namespace | Required to parse the file |
<url> | Yes | One page | |
<loc> | Yes | The page's full URL, with https:// and the host | Used for discovery |
<lastmod> | No | When the page's content last changed, as a W3C date | Used when consistently and verifiably accurate |
<changefreq> | No | How often the page changes | Ignored |
<priority> | No | 0.0–1.0 importance within the site | Ignored |
The last two columns come from Google's Search Central page "Build and submit a sitemap", which states plainly that Google ignores <priority> and <changefreq>. Other search engines may read them, but no search engine is obliged to follow them.
"Sitemap" can also mean a page for people that lists the site's sections (an HTML sitemap) or a planning diagram of a website's structure. This guide is about the XML file for search engines.
How Google uses your sitemap
Google finds most pages by following links. A sitemap adds a second route, and Google uses it in three ways:
- Discovery. New pages, pages deep in the site and pages with few internal links get found sooner, because they are listed rather than waiting to be reached by a link.
- Recrawling. An accurate
<lastmod>tells Google a page changed, so it can recrawl that page sooner and leave unchanged pages alone. Google's 2023 guidance on lastmod asks for the date of the last significant change: main content, structured data or links, not a copyright year in the footer. - Canonical hints. Listing a URL is a weak signal that it is the version you want indexed. When the sitemap, the canonical tags and the internal links all name the same URL, Google has an easy choice.
What a sitemap cannot do is just as important. Google's documentation says submitting a sitemap is "merely a hint": it does not guarantee that Google downloads the file, crawls the URLs in it or indexes them. A page that is thin, duplicate, blocked or noindexed stays out of the index whether it is in the sitemap or not. When listed pages are not indexed, the cause is the page, and why is my page not in Google walks through the checks in order.
The file also affects how much Google trusts it. A sitemap that lists redirects, 404s and noindexed pages, or stamps every URL with today's date, tells Google its hints are unreliable. A short, clean sitemap is worth more than a long one.
Do you need an XML sitemap?
Google's sitemap overview gives a clear rule of thumb. You probably need one if:
- the site is large, which Google puts at more than about 500 pages;
- the site is new and has few links from other sites;
- the site has a lot of video or images you want in Google's media results, or appears in Google News.
You might not need one if the site is small (about 500 pages or fewer), every page is reachable through internal links, and you have no media or news content that needs its own search visibility.
In practice, the question rarely needs an answer: almost every CMS creates a sitemap automatically, and it costs nothing to keep. Where it pays off most is a shop with thousands of products, a news or blog site with a steady flow of new posts, and any site after a redesign or migration, when many URLs change at once.
What goes in a sitemap, and what stays out
A sitemap is the list of pages you want in Google, not a list of every URL your server can answer. Each URL in it should pass five tests:
| Test | Why |
|---|---|
| Answers 200 directly, without a redirect | A redirect or error in the sitemap sends Google to a URL you do not want indexed |
Is indexable: no noindex tag or header | Listing a page and telling Google not to index it is a contradiction |
| Is its own canonical | Duplicates that point their canonical elsewhere belong out of the sitemap |
| Is not blocked in robots.txt | Google cannot crawl it, so it cannot index it properly |
| Uses the exact form you link to | Same protocol, host, trailing slash and case as the canonical |
The usual leftovers to remove: tag and date archives you have set to noindex, WordPress attachment pages, internal search results, cart and account pages, URLs with tracking or sort parameters, and pages that were deleted or redirected in a migration. When the list is generated by your CMS, fix the setting that includes them rather than editing the file by hand; the next regeneration would bring them back.
The sitemap format and its rules
Beyond the elements above, the sitemaps.org protocol and Google's documentation set a handful of rules that break more sitemaps than anything else:
- UTF-8 encoding, and special characters escaped:
&in a URL must be written&. - Absolute URLs in
<loc>, with protocol and host:https://example.com/page/, never/page/. - One host per file. A sitemap lists URLs from the host it sits on; cross-host listing works only when you prove ownership of both, for example through robots.txt or Search Console.
- Location sets the scope. A sitemap at
/blog/sitemap.xmlmay only list URLs under/blog/unless it is submitted in Search Console. Google recommends the site root. - W3C dates in
<lastmod>:2026-09-24, or a full timestamp with a timezone such as2026-09-24T09:15:00+02:00. - Google also accepts RSS 2.0, mRSS and Atom 1.0 feeds and plain text files with one URL per line. XML is the only format that carries images, video, news and hreflang.
Sitemap examples has copy-ready, annotated files for every type: a basic sitemap, an index, image, video and news sitemaps, hreflang in a sitemap and a plain text sitemap, plus a broken file with each mistake explained.
How to create an XML sitemap
Check first whether you already have one: open yourdomain/sitemap.xml, /sitemap_index.xml and /wp-sitemap.xml, and look for a Sitemap: line in yourdomain/robots.txt. Then use the route that fits your site:
| Your site | Where the sitemap comes from |
|---|---|
| WordPress, no SEO plugin | Core sitemap at /wp-sitemap.xml (since WordPress 5.5) |
| WordPress with Yoast SEO or Rank Math | The plugin's /sitemap_index.xml; it switches core's off |
| Shopify | Automatic /sitemap.xml index; not editable |
| Wix, Squarespace, Webflow | Automatic /sitemap.xml, updated as you publish |
| Hugo, Astro, Next.js and other frameworks | Built from the page list at build time, by the framework or a plugin |
| Hand-built or legacy site | A generator that crawls the site, or a script that writes the file from your database |
Whichever route, the file should update itself when pages are added or removed. A sitemap generated once and uploaded by hand goes stale with the first new page. How to create a sitemap walks through each route: the settings in each CMS, the files for Next.js, Astro and Hugo, a generator crawl, and a hand-written file or a short script.
For a site without a built-in sitemap, the XML sitemap generator crawls up to 100 pages from your home page the way a search engine would, respects your robots.txt, and keeps only pages that answer 200, are not noindexed and are canonical to themselves; everything it leaves out is listed with the reason. It uses your server's Last-Modified header for <lastmod> when there is one and writes no priority or changefreq. Crawling costs server time, so the generator is a funded unlock: it runs for everyone while donations cover it, and shows an example crawl when they do not.
WordPress sitemaps
WordPress core publishes a sitemap index at /wp-sitemap.xml with child sitemaps for posts, pages, categories, tags and authors. Yoast SEO and Rank Math replace it with their own index at /sitemap_index.xml and turn the core sitemap off, which is what you want: two sitemaps listing the same pages send mixed signals. The plugins let you exclude post types and taxonomies, which is where attachment pages, thin tag archives and author archives on single-author sites should be switched off. WordPress sitemaps: core, Yoast SEO or Rank Math compares the three, shows what to leave out and fixes the usual 404; the attachment-page problem is covered in WordPress attachment pages.
Shopify sitemaps
Shopify generates /sitemap.xml automatically as an index with child sitemaps for products, collections, pages and blog posts. You cannot edit it, but only items published to the Online Store sales channel are listed, so unpublished products and pages are left out automatically. If a page you expect is missing, check its visibility in the admin before anything else. Shopify's sitemap covers what it lists, how to hide a page with the seo.hidden metafield, international domains and the errors Search Console reports.
Large sites: sitemap index files
A single sitemap holds at most 50,000 URLs and 50 MB uncompressed. Above that, you split the URLs into several files and list the files in a sitemap index, a <sitemapindex> with one <sitemap><loc> per child file. An index can list up to 50,000 sitemaps, and you submit only the index.
Splitting helps long before the limit. One child file per type (products, categories, posts, pages) makes Search Console's Sitemaps report show which section Google reads and which it indexes, so a broken generator stands out at once. Files can be gzipped, and the size limit applies before compression. The full how-to, with index examples and what WordPress and other CMSs do on their own, is in sitemap index files: splitting large sitemaps the right way.
lastmod, priority and changefreq
Of the three optional fields, only <lastmod> does anything at Google, and only while it tells the truth. Set it to the date the page's content last changed in a way that matters to readers. Do not set it to the time the sitemap was generated, and do not bump it for a new comment or a theme update. A generator that stamps every URL with today's date teaches Google to ignore the field for the whole file.
<priority> and <changefreq> are ignored by Google, so leave them out; they add bytes and suggest a precision the file does not have. If you cannot produce an honest date, omit <lastmod> too: a missing value is neutral, a false one costs trust. The guide to sitemap priority, changefreq and lastmod explains why search engines stopped reading the first two, how to tell from one report whether your generator fakes lastmod, and how to fix it per CMS.
Image, video and news sitemaps
The XML format has extensions for media and news, each with its own namespace. Image entries add an <image:loc> per image to a page's <url>; Google retired the caption, title, geo-location and licence tags in 2022. Video entries describe each video's thumbnail, title, description and file or player URL. News sitemaps list only articles from the last two days, up to 1,000 per file, for sites in Google News.
Most sites need none of these: Google finds images and videos in normal HTML. They pay off when media loads through JavaScript, when you publish many videos, or when you are a news publisher. Since December 2023, a video only gets video results when it is the main content of its page, whatever the sitemap says. Video, image and news sitemaps explains when each is worth adding and which tags Google still reads.
hreflang in the sitemap
Multilingual sites can declare their language alternates inside the sitemap with <xhtml:link rel="alternate" hreflang="…"> entries, instead of link tags in each page's head. It keeps the HTML light and puts every language set in one place, which suits large sites. The rule is to pick one method and use only that one, so the two never disagree. The three methods, with working samples and how to choose, are in hreflang in sitemaps vs in HTML.
How to submit a sitemap to Google
There are two ways, and it is worth doing both:
- Declare it in robots.txt with a full URL:
Sitemap: https://example.com/sitemap.xml. Every crawler that reads robots.txt finds it this way, Google and Bing included, with no account needed. The robots.txt guide covers the rest of that file. - Submit it in Google Search Console under Indexing → Sitemaps: enter the sitemap URL and click Submit. The report then shows when Google last read the file, whether it could parse it and how many URLs it discovered. Do the same in Bing Webmaster Tools.
You submit once; Google comes back to read the file on its own schedule. Google retired its anonymous sitemap "ping" endpoint at the end of 2023, so there is nothing to resubmit after each update: an accurate <lastmod> does that job. Bing and several other search engines also accept IndexNow; Google does not use it. How to submit a sitemap to Google goes through verification, each screen in Search Console and Bing, and what Success, Has errors and Couldn't fetch mean.
How to find a website's sitemap
To find any site's sitemap, open its robots.txt and look for Sitemap: lines; that is the only public place a site states the address. If there is none, try the usual paths: /sitemap.xml, /sitemap_index.xml and /wp-sitemap.xml, or the default of the site's CMS. For your own site, Search Console's Sitemaps report lists the ones you submitted. How to find the sitemap of any website has the defaults per platform and what it means when nothing turns up.
HTML sitemaps and XML sitemaps
An HTML sitemap is an ordinary page that links to the site's main sections, written for people who get lost. An XML sitemap is a file for crawlers. They do different jobs: the HTML page helps visitors and adds internal links, the XML file helps discovery and signals canonical URLs. Large sites and shops can use both; a small, well-linked site needs neither the HTML page nor much thought about it. HTML sitemap vs XML sitemap compares them, shows when an HTML sitemap is worth building and how it helps accessibility.
How to check your sitemap
The sitemap checker finds the sitemaps declared in robots.txt (up to three) and /sitemap.xml, unpacks gzipped files, and parses each with a strict XML parser. It checks the root element and namespace, absolute same-host URLs, W3C dates in <lastmod>, the values of changefreq and priority, repeated URLs and the 50,000-URL limit. It then requests up to 25 of the listed URLs to confirm they answer 200 without redirecting, and tells you whether the page you entered is in the sitemap. Image and video extensions are tolerated but not validated yet.
When Search Console reports a problem, the status tells you where to look. "Couldn't fetch", usually shown with "Sitemap could not be read", means Google has not downloaded the file: right after submission that is often just pending, and later it points to an error, a redirect, an HTML page or a block. "Has errors" means Google read the file but could not parse some entries, such as invalid dates or URLs on another host. How to diagnose each case, step by step, is in fixing "Couldn't fetch" and other sitemap errors. The fix-page version is how to add and declare an XML sitemap.
XML sitemap best practices
- List only final, indexable, canonical URLs that answer 200. Nothing else.
- Generate it automatically from your CMS or build, so it changes when pages do.
- Keep one sitemap source. A core sitemap plus a plugin sitemap, or a plugin sitemap plus an old uploaded file, means two lists that disagree.
- Use honest
<lastmod>dates, or none. - Split by type once you have a few thousand URLs, and submit the index.
- Declare it in robots.txt and submit it in Search Console and Bing Webmaster Tools.
- Update it after a migration so it lists the new URLs, not the redirected old ones.
- Validate after every change to the generator, the theme or the plugin.
Common mistakes
- Listing redirects and 404s, often after a migration or a URL change. Google treats the file as less reliable.
- Including
noindexpages such as tag archives or attachment pages, so the sitemap and the pages contradict each other. - Two sitemaps from two sources that list different URL forms (with and without
wwwor the trailing slash). - Every
<lastmod>set to today. The field is then ignored for the whole file. - Relative URLs in
<loc>, or an&left unescaped, which makes the XML invalid. - A sitemap that is blocked in robots.txt or sits behind a login, so Google cannot fetch it.
- Expecting the sitemap to force indexing. It helps Google find pages; whether they are indexed depends on the pages.
Questions people ask
What is a sitemap.xml file?
A sitemap.xml file is the standard name for an XML sitemap: a file at the root of a website that lists the URLs its owner wants search engines to index, each with an optional last-modified date. It follows the sitemaps.org protocol, is read by Google, Bing and other crawlers, and is usually created automatically by the site's CMS or SEO plugin.
What is an XML sitemap used for?
An XML sitemap is used to help search engines discover a site's pages and notice when they change. It matters most for new pages, pages deep in the site and sites with few inbound links. It also signals which URL of a page you consider canonical. It does not guarantee indexing or improve rankings on its own; Google treats it as a hint.
Do I need a sitemap for a small website?
Not strictly. Google says a site of about 500 pages or fewer, where every page is linked from other pages, may not need one. It still helps a small site get new pages found sooner and gives you Search Console reports per sitemap. Since most website builders and CMSs create one automatically, keep it and make sure it lists only live pages.
Does a sitemap help SEO?
Yes, indirectly. A sitemap does not raise rankings, but it helps Google find and recrawl your pages, which is a precondition for ranking at all. The benefit is largest for big sites, new sites and pages with few internal links. A sitemap full of redirects, 404s or noindexed pages helps less, because Google learns to trust its hints less.
What should an XML sitemap include?
An XML sitemap should include every page you want in search results, and only those: the full canonical URL of each page that answers 200 and has no noindex, plus an accurate lastmod date when you have one. Leave out redirects, error pages, duplicates, internal search results, cart and account pages, and anything blocked in robots.txt.
How often should I update my XML sitemap?
Update it whenever pages are added, removed or meaningfully changed, which in practice means letting your CMS or build process regenerate it automatically. A hand-made sitemap goes stale with the first new page. There is no need to resubmit it in Search Console after each update; Google rereads submitted sitemaps on its own schedule and uses accurate lastmod dates to spot changes.
Does submitting a sitemap guarantee that Google indexes my pages?
No. Google calls a sitemap a hint: it may not download the file, crawl every listed URL or index them. Pages are indexed when Google can crawl them and judges them worth indexing, so thin, duplicate, blocked or noindexed pages stay out regardless. Search Console's Page indexing report, filtered by sitemap, shows which listed pages are not indexed and why.
What are XML sitemap best practices?
List only canonical URLs that answer 200 directly and that you want indexed: no redirects, 404s, noindex pages or parameter duplicates. Use absolute URLs on the same host, honest <lastmod> dates that change only when the content does, and at most 50,000 URLs or 50 MB per file, with a sitemap index above that. Generate it automatically from your CMS, declare it in robots.txt and validate it after every migration or plugin change.