An XML sitemap is a file that lists the URLs on your site you want search engines to know about, usually with the date each was last modified. It does not raise rankings by itself and does not guarantee a page gets indexed: it helps Google discover your pages sooner and learn which ones you consider important. Your content management system generates it and you submit it from Search Console.
On a small, well-linked site Google would find the pages anyway. I still recommend always having one: it takes five minutes and gives you a very useful report in return, namely how many of the URLs you declare as important are actually indexed.

What an XML sitemap is (and is not)
It is a file meant for machines, not people. It usually lives at https://www.example.com/sitemap.xml and follows a standard format understood by Google, Bing and other search engines. Do not confuse it with the HTML “site map” page some websites link in the footer.
| XML sitemap | HTML site map | |
|---|---|---|
| Audience | Search engines | Visitors |
| Format | XML file with one entry per URL | Ordinary page with links |
| Where it appears | Not linked; submitted to Search Console | Linked from the footer or menu |
| Purpose | Discovery and index monitoring | Navigation |
When you need an XML sitemap
Google states that a sitemap helps mostly in these cases:
- Large sites: shops with thousands of products, portals, directories. A new or updated page can easily be missed by the crawler.
- New sites with few external links: Google reaches pages by following links, and if hardly anyone links to you, it takes longer to find you.
- Pages poorly linked to each other: product pages only reachable through internal search or a filter.
- Lots of image, video or news content, which supports sitemaps with additional information.
And that it may not be needed when the site is small (a few hundred pages at most) and every page is linked from the menu or from other pages. That is the case for the corporate site of an accountancy firm in Lleida or a restaurant in Tarragona. My rule: if your CMS generates it automatically, submit it anyway. It does no harm, and the day something breaks you will have the data to see it.
XML sitemap structure: a valid example
This is a minimal, correct sitemap. You can copy it, change the URLs and validate it:
<?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-01</lastmod>
</url>
<url>
<loc>https://www.example.com/services/kitchen-renovations/</loc>
<lastmod>2026-09-18</lastmod>
</url>
<url>
<loc>https://www.example.com/contact/</loc>
</url>
</urlset>| Tag | Required? | What you need to know |
|---|---|---|
<loc> | Yes | Full URL, with protocol and domain, exactly as you want it indexed. |
<lastmod> | No | Date of the last real content change (YYYY-MM-DD format). Google uses it if it finds it reliable. |
<changefreq> | No | Google ignores it. You can leave it out. |
<priority> | No | Google ignores it. You can leave it out. |
Format rules:
- The file must be UTF-8 and use absolute URLs. Special characters are escaped: an
&inside a URL is written&. - Each sitemap holds at most 50,000 URLs or 50 MB uncompressed. Beyond that, split it and use a sitemap index.
- Place it at the root of the domain so it covers the whole site.
A sitemap index is another XML file that points to the others. It is also useful below the limit, to split by content type and see indexing for each group:
<?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-01</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap-blog.xml</loc>
<lastmod>2026-09-28</lastmod>
</sitemap>
</sitemapindex>How to create an XML sitemap
It is almost never written by hand. It depends on what the site is built with:
- WordPress: since version 5.5 it generates its own at
/wp-sitemap.xml. If you use an SEO plugin, it usually creates its own and disables the WordPress one; submit only one of the two. - Online shops: most platforms generate it themselves or through an official module. Check that it includes active categories and products, not the discontinued ones you have removed.
- Custom-built site: ask the developer to generate it dynamically from the database so it updates itself on publishing.
- Small static site: you can write it by hand from the example above. Remember to update it every time you add or remove a page.
What to include: only the URLs you want to see in Google, in their canonical version and returning a 200 status.
What to leave out: redirecting URLs, 404 pages, pages with noindex, versions with filter or sort parameters, internal search results and private areas.
How to submit the sitemap to Google Search Console
- Open the sitemap in your browser and check that it loads and the URLs are right.
- Go to Search Console and choose your site's property.
- In the side menu, open Sitemaps.
- Type the address of the file (for example
sitemap.xml) and click submit. - Come back after a few days: you will see whether Google could read it and how many URLs it discovered. From there you can open the indexing report filtered by that sitemap.
If this is your first time in the tool, the guide on how to use Google Search Console step by step explains how to add the property and the rest of the reports.
The second route is to declare it in the robots.txt file with a Sitemap: line followed by the full URL; that way other search engines find it too. The old method of notifying Google with a “ping” no longer works.
Common sitemap mistakes
- Listing URLs that should not be there: redirects, deleted pages or pages with
noindex. You send Google contradictory signals and muddy your own reports. - Setting today's date on every
lastmod. If the date changes when the content does not, Google stops trusting it. Better nolastmodthan a false one. - Mixing versions:
httpURLs when the site runs onhttps, with and withoutwww, or with a trailing slash that differs from the real URL. - A sitemap that is not XML: the address returns an error page, a login screen or is blocked, and Search Console reports it could not fetch it.
- Forgetting it after changing the site. After a redesign the sitemap still points to the old URLs; it is one of the checklist items in any SEO migration.
- Confusing “submitted” with “indexed”. If many sitemap URLs are not indexed, the problem lies in the pages, not the file: follow the diagnosis of why Google is not indexing your website.
Frequently asked questions
Is an XML sitemap mandatory?
No. Google can discover your pages by following links. It is strongly recommended for large or new sites and for those with poorly linked pages, and worthwhile for the rest because of the information it gives you in Search Console.
Does a sitemap improve rankings?
Not directly. It helps Google discover and recrawl your pages sooner, but it does not move them up or force them to be indexed.
Where should the file be?
The root of the domain is recommended, for example https://www.example.com/sitemap.xml. The name can be different; what matters is that the URL is accessible and that you tell Google where it is.
How often should it be updated?
Every time you publish or delete a page or change its URL. That is why it is best generated by the CMS itself: it updates automatically and does not depend on someone remembering.
In short
An XML sitemap is a clean list of the pages you want in Google: canonical URLs only, working, with real dates. Create it with your CMS, submit it to Search Console and review it whenever you change the site structure. If you want to know which pages on your site are not being indexed and why, request the free initial analysis; we review the sitemap along with the rest of your technical SEO.