XML sitemap
An XML sitemap is a file in XML format that gives search engines a list of a website's URLs available for indexing. Each URL can carry information about the date of its last change, how often it is updated and the relative importance of the page. The format is described by the Sitemaps 0.90 protocol published on sitemaps.org and supported by Google, Yahoo! and Microsoft. A sitemap is a hint for crawlers. According to sitemaps.org, using one does not guarantee that pages will appear in search results.
How is an XML sitemap structured?
An XML sitemap consists of three required tags: <urlset>, <url> and <loc>. The other elements of the protocol are optional. The file must be UTF-8 encoded, and special characters in URLs are written as XML entities. Gzip compression is allowed.
| Tag | Status | Meaning according to sitemaps.org |
|---|---|---|
| <urlset> | required | Wraps the whole file and references the protocol version |
| <url> | required | Parent element of a single URL |
| <loc> | required | Full page URL with the protocol, shorter than 2,048 characters |
| <lastmod> | optional | Date of the page's last change in W3C Datetime format |
| <changefreq> | optional | Expected change frequency, from always to never |
| <priority> | optional | Relative importance of the URL on a 0.0-1.0 scale, 0.5 by default |
The date in <lastmod> should reflect a change to the page content, not the moment the file was generated. The protocol defines <changefreq> as a hint, not a command. <priority>, in turn, compares URLs only within one website. It does not affect rankings against other sites.
Example of a minimal file with a single URL:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://zest.agency/definicje</loc>
</url>
</urlset>
What are the limits of an XML sitemap and what is a sitemap index?
An XML sitemap can contain at most 50,000 URLs and weigh no more than 50 MB uncompressed. The sitemaps.org protocol specifies this limit as 52,428,800 bytes. Larger sites therefore split their URLs across several files. For example, separate sitemaps cover blog posts, categories and product pages.
The files are tied together by a sitemap index. It uses the <sitemapindex>, <sitemap> and <loc> tags, and the optional <lastmod> gives the date a given sitemap changed. An index can point to up to 50,000 sitemaps and is subject to the same 50 MB limit. In robots.txt it is then enough to list the index alone.
Other formats and extensions
Google accepts sitemaps in three formats: XML following the protocol, RSS 2.0 or Atom 1.0 feeds, and a plain text file. The text file contains only URLs, one per line. The XML format also supports Google extensions. They let you describe images, videos and news content (Google News).
How does Google use an XML sitemap?
Google treats an XML sitemap as a hint, not a command. The Google Search Central documentation (updated 8 July 2026) notes that submitting a sitemap does not guarantee it will be fetched or used for indexing. The search engine ignores <priority> and <changefreq> values. It takes <lastmod> into account only when it is consistently and verifiably accurate to the actual change of the page.
The documentation recommends full, absolute URLs and listing canonical URLs in the sitemap. The sitemap is best published in the root directory of the domain. Without submission in Search Console, the file only covers URLs in the directory where it sits and its subdirectories.
Ways to submit a sitemap
Google describes three ways to submit a sitemap:
- the Sitemaps report in Google Search Console;
- a Sitemap: line with the full file URL in robots.txt, anywhere in the file;
- the Search Console API, useful when managing many sites.
The robots.txt entry is also read by other search engines that support the protocol, including Bing. A sitemap can be written by hand or generated in a CMS, with a built-in feature or a plugin. Sitemap correctness, consistency with canonical URLs and errors in the Search Console report are checked during an SEO audit.
Frequently asked questions
Q.Does every website need an XML sitemap?
No, an XML sitemap is not mandatory, and sitemaps.org describes it as a hint for crawlers. Its job is to tell search engines which URLs are available for indexing. Google does not guarantee it will fetch a submitted sitemap either. The file does, however, make it easier to control which canonical URLs the site wants to show in search results.
Q.Where should the sitemap.xml file go?
The sitemap.xml file is best placed in the root directory of the domain, for example at /sitemap.xml. According to Google, a sitemap not submitted in Search Console only covers URLs from the directory where it sits. The file URL is added to robots.txt on a Sitemap line. You can also submit it manually.
Q.Does the priority tag affect Google rankings?
No, Google ignores the priority and changefreq tags in a sitemap. The sitemaps.org protocol only intends priority to compare URLs within a single website anyway. What does matter is an accurate lastmod. Google uses this date when it consistently matches the actual content change.
Q.How many URLs can a single sitemap contain?
A single sitemap can contain at most 50,000 URLs and be up to 50 MB uncompressed. A larger site is split into several sitemaps. They are tied together by a sitemap index, which points to up to 50,000 files. In robots.txt and Search Console you then list only the index URL.
Let's talk growth
Send a brief or drop your contact. We'll reply within 24h.
Get a quote