What Is an XML Sitemap? Format, Tags & Examples

An XML sitemap lists the pages on your website for search engines. Here is how it works, which tags it uses, and examples you can copy.

What Is an XML Sitemap? Format, Tags & Examples
Contents
  1. What an XML sitemap does
  2. XML sitemap example
  3. XML sitemap tags explained
  4. Where is the XML sitemap located?
  5. Sitemap size limits and the sitemap index
  6. Types of sitemaps
  7. XML sitemap vs HTML sitemap
  8. Do you need an XML sitemap?
  9. What should be in your sitemap, and what should not
  10. How to create and submit a sitemap

An XML sitemap is a file that lists the important pages on your website in a format search engines can read. It usually lives at https://yourdomain.com/sitemap.xml and tells Google, Bing and other search engines which URLs exist and, optionally, when each one last changed. It helps them find and re-crawl your pages. It does not guarantee indexing and does not boost rankings on its own. In this guide you will see a real example, learn what every tag means, and find out when you need a sitemap and what belongs in it.

What an XML sitemap does

Search engines discover pages in two main ways: by following links, and by reading sitemaps. Links work well for popular, well-linked pages, but they miss things. A sitemap gives the crawler a complete list in one place. Pages that are new, deep in your site or poorly linked still get found.

Think of it as a delivery list, not a recommendation. A sitemap helps search engines know your pages exist and which ones changed recently. A page that is never crawled can never rank, so that matters. But whether a page is indexed and how well it ranks still depends on its quality, its links and its relevance.

Does a sitemap guarantee indexing?

No. Google treats a sitemap as a strong hint about which URLs you consider important, but it still crawls and judges every page on its own. It is normal for Search Console to show fewer indexed pages than your sitemap lists. Duplicate, thin or low-value pages are often left out. If many sitemap URLs stay unindexed, look at the pages themselves, not just the sitemap.

How Google uses the sitemap over time

Google re-reads known sitemaps on its own schedule. When it sees new URLs, it adds them to its crawl queue. When a page’s <lastmod> date changes, and Google has learned that your dates are accurate, it uses that as a signal to re-crawl the page sooner. Correct, honest dates make a sitemap much more useful than a plain list.

XML sitemap example

Here is a complete, valid 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-11-20</lastmod>
  </url>
  <url>
    <loc>https://example.com/about-us</loc>
    <lastmod>2026-10-02</lastmod>
  </url>
</urlset>

The file always starts with the XML declaration and is saved as UTF-8. Next comes a <urlset> root element with the sitemaps.org namespace, and each page sits inside its own <url> block. Special characters in URLs must be escaped. For example, & becomes &amp;.

XML sitemap tags explained

TagRequired?What it means
<urlset>YesThe root element that wraps every URL, with the sitemaps.org namespace.
<url>YesOne block per page.
<loc>YesThe full, absolute URL of the page, e.g. https://example.com/page.
<lastmod>RecommendedWhen the page last changed, in W3C format (2026-11-20 or with time). Google uses it if it is consistently accurate.
<changefreq>OptionalHow often the page is expected to change. Google ignores it.
<priority>OptionalImportance from 0.0 to 1.0 compared with your other pages. Google ignores it.

Why Google ignores the last two tags, and when you might still use them, is explained in our guide to sitemap priority and changefreq.

Tip: Only add lastmod when it reflects real content changes. If every page always shows today’s date, search engines learn to ignore it.

Where is the XML sitemap located?

Most sites keep the sitemap in the root folder, at /sitemap.xml. Platforms often use their own names. WordPress uses /wp-sitemap.xml, Yoast SEO and Rank Math use /sitemap_index.xml, and Shopify, Wix and Blogger use /sitemap.xml. Under the sitemap protocol, a sitemap in the root can list any URL on that host, while a sitemap inside a folder should only list URLs in that folder. That is one more reason to keep it in the root.

To find the sitemap of any website, yours or a competitor’s, enter the domain in our Sitemap Finder. It checks robots.txt and the usual locations for you. Search engines find yours fastest when you list it in robots.txt, as shown in how to add a sitemap to robots.txt.

Sitemap size limits and the sitemap index

One sitemap file can hold up to 50,000 URLs and must be no bigger than 50 MB uncompressed. Larger sites split their URLs over several files and join them with a sitemap index, a sitemap of sitemaps:

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

You submit only the index, and search engines then read every file it lists. WordPress SEO plugins like Yoast and Rank Math use exactly this setup. Many smaller sites use one too, because separate files for pages, posts and products are easier to monitor. All the numbers are covered in sitemap size limits explained.

Types of sitemaps

Besides the standard page sitemap, Google supports extensions that add extra information:

  • Image sitemaps list the images on each page with <image:image>, helping them appear in Google Images.
  • Video sitemaps describe the videos on a page, including the title, description, thumbnail and player URL. Create one with our Video Sitemap Generator.
  • News sitemaps are for publishers in Google News and list articles from the last two days.
  • Hreflang sitemaps connect the language versions of a page. See hreflang in XML sitemaps.

Each extension needs its own namespace on the <urlset> tag. Sitemaps can also be plain text files (one URL per line) or RSS/Atom feeds, but XML is the only format that supports all of these extras.

XML sitemap vs HTML sitemap

An XML sitemap is written for search engines and is rarely seen by visitors. An HTML sitemap is a normal web page that links to your main sections, so people can find their way around. They do different jobs, and many sites have both. Read HTML sitemap vs XML sitemap to decide whether you need the HTML version too.

Do you need an XML sitemap?

Google says a sitemap is most useful when:

  • your site is new and has few links from other websites;
  • your site is large, with hundreds or thousands of pages;
  • you have pages that are not well linked from your menus or other pages;
  • you publish or update content often;
  • you have lots of images or videos you want indexed.

A small, well-linked site of a few pages may be found without one. But a sitemap costs nothing and removes the guesswork, so most sites should have one.

What should be in your sitemap, and what should not

A good sitemap lists only the final, indexable version of each page you want in search results. Leave out:

  • pages that redirect elsewhere;
  • pages that return errors (404, 500);
  • pages marked noindex;
  • duplicate pages whose canonical URL points somewhere else (see non-canonical URLs in sitemaps);
  • pages blocked by robots.txt.

Listing these sends mixed signals and wastes crawl time. Our generator leaves them out automatically, and our Sitemap Checker can test an existing sitemap for them.

How to create and submit a sitemap

  1. Create it. Most platforms make one for you. For any other site, our free XML Sitemap Generator crawls your pages and builds the file in a few minutes. The full walkthrough is in how to create an XML sitemap.
  2. Check it. Run it through the Sitemap Checker to catch XML errors, broken URLs and wrong dates before Google does.
  3. Submit it. Upload it to your root folder, add it to robots.txt and submit it to Google Search Console.

Frequently asked questions

Quick answers to the questions we hear most. Still have a question? Ask us through our contact page.

What is an XML sitemap in simple words?

It is a file that lists the important pages of your website so search engines like Google and Bing can find and crawl them.

Does an XML sitemap improve rankings?

Not directly. It helps search engines discover and re-crawl your pages, which they must do before a page can rank.

How many URLs can one sitemap have?

Up to 50,000 URLs and 50 MB uncompressed. Larger sites use several sitemaps joined by a sitemap index.

Where should my sitemap be?

Usually in the root folder of your website, at https://yourdomain.com/sitemap.xml, and listed in robots.txt.

Does a sitemap guarantee my pages get indexed?

No. A sitemap helps Google find your pages, but Google still decides which ones to index based on quality and duplication. It is normal for fewer pages to be indexed than the sitemap lists.

What is the difference between an XML and an HTML sitemap?

An XML sitemap is a file for search engines that lists your URLs. An HTML sitemap is a normal web page for visitors that links to your main sections. Many sites have both.

Crawly

Crawly is the friendly sitemap guide of XML Sitemap Generator. Every guide is written and checked by the team behind our free sitemap tools.

Related articles

Sitemap Guides

How to Create an XML Sitemap (Step by Step)

23 Nov 2026 · 4 min read
Sitemap Guides

How to Submit Your Sitemap to Google Search Console

23 Nov 2026 · 6 min read
Technical SEO

HTML Sitemap vs XML Sitemap: Differences and Examples

23 Nov 2026 · 5 min read