What is an XML sitemap?

By Pablo Murad. Last updated

An XML sitemap is a file on your site that lists the URLs you want search engines to know about. Crawlers read it to find pages they could miss by following links alone, and Google says it helps them crawl your site more efficiently. It is a hint: listing a URL does not guarantee that Google crawls or indexes it.

Do you need an XML sitemap?

Google says that in most cases a site benefits from having one, and its sitemap overview names the situations where it matters most:

  • Your site is large, which makes it harder to be sure that every page is linked from another page.
  • Your site is new and has few external links, so crawlers might not discover pages that no other site links to.
  • Your site has many video or image files, or appears in Google News.

You can probably skip it if the site has about 500 pages or fewer (counting only the pages you want in search results), every important page is reachable through internal links from the home page, and you have few video, image or news pages you want to show in Search. Many CMSs and hosting services, including WordPress, Wix and Blogger, may already publish a sitemap for you.

What goes into an XML sitemap

Each page needs one thing, its URL. The last modification date is worth adding when you can keep it accurate. The other fields are optional and, for Google, mostly decoration.

XML sitemap tags, whether they are required, and how Google treats them
TagRequiredWhat it holdsHow Google treats it
<urlset>YesRoot element. Declares the protocol namespace.A wrong or missing namespace triggers the "Incorrect namespace" error.
<url>YesOne entry per page.Wraps the fields below.
<loc>YesThe page URL, starting with the protocol and shorter than 2,048 characters.Google asks for fully qualified, absolute URLs and crawls them exactly as written.
<lastmod>NoWhen the page last changed, in W3C Datetime format. A plain date such as 2026-10-21 is allowed.Used only if it is consistently and verifiably accurate.
<changefreq>NoA hint about how often the page changes: always, hourly, daily, weekly, monthly, yearly or never.Ignored.
<priority>NoA number from 0.0 to 1.0 (default 0.5) that ranks a URL against other URLs on the same site.Ignored.

Sources: Google, build and submit a sitemap and the sitemaps.org protocol. The protocol says the date must be when the linked page was last modified, not when the sitemap was generated. Google counts significant changes to main content, structured data or links; updating a copyright date does not count. The lastmod guide goes deeper.

Sitemap limits: 50,000 URLs and 50 MB per file

A single sitemap file can hold 50,000 URLs or 50 MB uncompressed, whichever it reaches first. Larger sites split their URLs across several files.

Documented sitemap limits
LimitValueSource
URLs per sitemap file50,000Google, sitemaps.org
Size per sitemap file50 MB (52,428,800 bytes) uncompressed. Gzip is allowed, but the limit applies to the uncompressed file.Google, sitemaps.org
Sitemaps listed in one index file50,000sitemaps.org, Search Console Help
URLs in one news sitemap1,000Search Console Help
Length of one <loc> URLUnder 2,048 characterssitemaps.org
EncodingUTF-8Google, sitemaps.org

The 50,000-URL limit guide explains which limit you hit first.

Sitemap index files for large sites

A sitemap index is an XML file that lists other sitemap files. You submit the index once and Google follows it to each sitemap. An index can list only sitemap files, not other indexes (Search Console reports "Incorrect sitemap index format: Nested sitemap indexes"), and only sitemaps from the same site as the index.

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://www.example.com/sitemap-pages.xml</loc>
    <lastmod>2026-10-21</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://www.example.com/sitemap-blog.xml</loc>
  </sitemap>
</sitemapindex>

XML, RSS, Atom and text formats

Google accepts three kinds of sitemap. XML is the most versatile: it can carry data about images, video, news and localized page versions. RSS 2.0, mRSS and Atom 1.0 feeds cover only recent URLs and can describe video but not images or news. A text sitemap is one URL per line in a file with a .txt extension. Bing accepts XML, RSS 2.0, Atom 0.3 and 1.0, and text.

Image, video and news extensions

Google supports image, video and news extensions inside an XML sitemap. They add details such as video running time, image locations and news publication dates. Each extension declares its own namespace in the root element; a video sitemap, for example, adds xmlns:video="http://www.google.com/schemas/sitemap-video/1.1". The Search Console Sitemaps report accepts these URLs but does not currently show data for them.

A minimal XML sitemap example

Each <url> needs a <loc>. Everything else can be left out.

<?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-10-14</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/pricing</loc>
    <lastmod>2026-10-21</lastmod>
  </url>
</urlset>

How to submit a sitemap to search engines

  • Google Search Console: paste the sitemap URL into the Sitemaps report. Submitting only tells Google where the file is; you cannot upload it. The report needs owner permissions on the property and shows only sitemaps submitted through it or through the API.
  • robots.txt: add a line such as Sitemap: https://www.example.com/sitemap.xml with the full URL. You can list several, and the line is independent of any user agent. This works without owner permissions and is also how Bing can find the file. See Google's robots.txt specification.
  • Bing Webmaster Tools: submit the file on the Sitemaps page, or import your sitemaps from Google Search Console. Bing documents the same robots.txt line. Bing's sitemap help has the steps.
  • IndexNow: a separate protocol for telling participating search engines which URLs were added, updated or deleted. It needs a key file on your host and accepts up to 10,000 URLs per request. It complements a sitemap; it does not replace one. See the IndexNow documentation.

Common XML sitemap mistakes

  • Listing URLs that are not canonical. Google asks you to list canonical URLs.
  • Using relative URLs. Google asks for absolute, fully qualified ones.
  • Stamping every URL with today's date. The protocol ties lastmod to the page, and Google uses it only when it stays accurate.
  • Mixing hosts or paths. A sitemap can list only URLs under its own path and on its own protocol and host, unless you submit it through Search Console.
  • Listing URLs that robots.txt blocks. Search Console reports "Sitemap contains urls which are blocked by robots.txt".
  • Breaking the XML with an unescaped ampersand, curly quotes or a wrong namespace.

The Search Console errors guide lists each message with its fix. To check a file you already have, use the free sitemap validator.

What GenMap puts in the file

GenMap crawls your site and writes the sitemap for you. It lists only pages that return 200, are not marked noindex and are their own canonical, takes lastmod from the date each page reports, and leaves it out when a page reports none.

Generate an XML sitemap from your own site.

Crawl a site