XML Sitemap Explained: 5 Simple Facts for Beginners cover image
Prateek Zare

Written by Prateek Zare

Software Developer with ML and Data Expertise, 8+ years of experience

Last updated
SEO and Marketing

XML Sitemap Explained: 5 Simple Facts for Beginners

An XML sitemap is a plain file that lists the pages of your website you want search engines to find. Think of it as a contents page handed to a visitor who has never been to your site. It does not make pages rank, but it makes sure they are not missed.

If you have heard of an XML sitemap and never opened one, this guide starts from zero. You will see what the file looks like, what each part means, where the limits are, and how to make one without writing code.

What an XML sitemap does, in plain words

Search engines find pages by following links. That works well for pages linked from your homepage and poorly for pages buried deep or linked from nowhere. A sitemap gives the crawler a direct list, so those pages are at least known.

It is a hint, not an order. Google states that submitting a sitemap helps discovery but does not guarantee that every listed address is crawled or indexed. Its value is highest for large sites, new sites with few outside links, and sites with lots of media.

Do small sites need an XML sitemap?

Google says a small site of roughly 500 pages or fewer, which is well linked from the homepage, may not need a sitemap. Many owners add one anyway because it costs nothing and gives a place to check what you think is live.

A short history

Google introduced the idea in 2005 under the name Google Sitemaps. In 2006, Google, Yahoo and Microsoft agreed to share one format, published on sitemaps.org as protocol version 0.9. That is why every XML sitemap declares the namespace you will see in the example below, and why the same file works across search engines today.

A site has 75,000 pages that belong in its XML sitemap. What does it need?

The limit is 50,000 URLs per file, so 75,000 addresses need two files. A sitemap index lists both so you submit a single address.

What one looks like

Here is a complete XML sitemap with two pages. Every sitemap follows this shape: a wrapper called urlset, then one url block per page.

sitemap.xml 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-10-01</lastmod>
  </url>
  <url>
    <loc>https://example.com/blog/first-post/</loc>
    <lastmod>2026-09-18</lastmod>
  </url>
</urlset>

Only urlset, url and loc are required. Everything else is optional. The table lists each tag and how much it matters.

Tags inside a url block
TagRequired?What it holdsDoes it help?
locYesThe full address, under 2,048 charactersEssential
lastmodNoDate the page last changed, as YYYY MM DDUseful if accurate
changefreqNoA guess such as daily or monthlyLargely ignored by Google
priorityNoA number from 0.0 to 1.0Largely ignored by Google

Be honest with lastmod in your XML sitemap. It should show when the page content really changed, not when the sitemap was generated. A date that changes every day for every page teaches crawlers to ignore it.

How the URLs are written

Every address must be complete, with the https:// part and the host. The file is XML, so a few characters have special meaning and must be replaced by codes. This trips up many first timers, because search and filter addresses contain ampersands.

XML sitemap characters that must be escaped inside loc
CharacterWrite it as
Ampersand&amp;
Single quote&apos;
Double quote&quot;
Greater than&gt;
Less than&lt;

An unescaped ampersand makes the whole XML sitemap invalid. Google then rejects the sitemap on a parse error, instead of skipping the one bad line. The generator escapes every address and parses the result back to confirm the file is well formed before you download it.

Where it lives and what it can list

Put the file in the root folder, so it sits at example.com/sitemap.xml. A sitemap can only list addresses at or below its own folder, on the same protocol and host. A file at example.com/catalog/sitemap.xml cannot list pages under example.com/images/. A file for https cannot list http pages.

Tell search engines about your XML sitemap in two ways. Submit it in Search Console, and add one line to robots.txt, which also helps other crawlers find it.

Adding the sitemap to robots.txt

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

The robots.txt Generator can add that line for you, and the post on robots.txt allow, disallow and sitemap rules explains how the two files work together.

The 50,000 URL limit and the sitemap index

One sitemap may hold up to 50,000 URLs and must stay under 50 MB once uncompressed, which is 52,428,800 bytes. Gzip helps with transfer, but the uncompressed size still counts. Bigger sites split their list across several files and add a sitemap index that points to them.

How many files a site needs
URLs on the siteCalculationSitemap filesIndex file?
30,000Fits in one file1No
50,000Exactly one full file1No
50,00150,001 divided by 50,000 rounds up2Yes
120,000120,000 divided by 50,000 is 2.4, so 33Yes
2,200,0002,200,000 divided by 50,000 is 4444Yes

The generator does this XML sitemap split for you. Above 50,000 valid addresses, it writes numbered files plus an index and bundles them into one download. It counts URLs exactly. It does not measure file size, so if your addresses are unusually long, check the byte size before uploading. For planning very large sites, see the guide to sitemap strategy for large websites.

Paste your addresses or crawl a site, choose your options and download a valid, escaped file, split and zipped automatically when the list is large.

Open the XML Sitemap Generator

An example of priority by folder depth

The generator can set priority automatically from how deep a page sits. The homepage gets 1.0, and each step down the folder tree lowers the value. Remember that Google largely ignores this field, so treat it as bookkeeping, not a ranking lever.

Automatic priority by depth
AddressFolder depthPriority
https://example.com/01.0
https://example.com/blog/10.8
https://example.com/blog/sitemaps/20.6
https://example.com/shop/shoes/running/30.5
https://example.com/shop/shoes/running/trail/40.4

What to leave out

List only pages you want people to find in your XML sitemap. That means leaving out pages marked noindex, pages that redirect, error pages and duplicate versions of the same content. A noindex page in a sitemap gives two opposite messages: please index this, and please do not. The crawl mode of the generator skips noindex pages for that reason.

In an XML sitemap, list the canonical address of each page, not a parameter version. If you are unsure which one that is, the Canonical Tag Checker shows what a page declares.

Making your first one, step by step

  1. Collect your addressesExport them from your CMS, a spreadsheet or a crawl. One address per line works.
  2. Paste them into the generatorOr let it crawl your site, which follows internal links up to 200 pages and skips noindex pages.
  3. Choose the optional XML sitemap fieldsSet lastmod to today, to a date you pick, or leave it out. Pick one change frequency or none, and fixed or automatic priority.
  4. Download and uploadSave sitemap.xml and upload it to the root folder of your site.
  5. Submit and reference itAdd it in Search Console and put the Sitemap line in robots.txt.
  6. Check it again after big changesAfter a migration or a bulk URL change, regenerate the file. See the broken link checklist after a site migration for what else to verify.

Words you will meet

urlset
The outer element of a sitemap file. It declares the namespace and wraps all url entries.
loc
The full address of one page. It is the only required tag inside a url block.
lastmod
The date a page last changed, written as YYYY MM DD.
Sitemap index
A file that lists other sitemap files, used when a site passes 50,000 addresses.
Crawler
A program that visits pages and follows links to discover content.
Namespace
The sitemaps.org address inside urlset that tells software which format rules apply.
Escaping
Replacing special characters such as the ampersand with safe codes like the amp entity.

Frequently asked questions

What is an XML sitemap and why do I need one?

It is a file listing the pages you want search engines to find. It helps them discover pages that are poorly linked, which matters most on large or new sites.

Where do I upload my XML sitemap file?

Upload sitemap.xml to the root folder of your site so it loads at your domain followed by slash sitemap.xml. Then submit it in Search Console and list it in robots.txt.

How many URLs can an XML sitemap hold?

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

Does a sitemap improve rankings?

No, not directly. It improves discovery, so pages can be crawled and considered. Ranking still depends on the content and the usual signals.

Do I need to fill in priority and changefreq?

No. Both are optional, and Google has said it largely ignores them. An accurate lastmod is more useful.

How often should I update my sitemap?

Whenever you add, remove or significantly change pages. A CMS plugin can update it automatically, or you can regenerate the file after big changes.

Sources: sitemaps.org: Sitemap protocol · Google Search Central: Sitemaps overview