# XML Sitemap Best Practices: Format, Limits, lastmod and Audits

> List only canonical, indexable URLs that return 200, as absolute URLs in UTF-8 files of at most 50,000 URLs and 50 MB uncompressed. Split larger sets with a sitemap index, set lastmod only to the real date of the last significant change, and submit the sitemap in Search Console and with a robots.txt Sitemap line.

- Canonical URL: https://backlnk.com/blog/xml-sitemap-best-practices
- Byline: Miguel Santiago
- First published: 2026-11-01
- Topics: Technical SEO
- Evidence: observed results from our own data or tests; external research (cited); editorial interpretation; hypothetical, illustrative examples (labelled) — not real results

The rules that make an XML sitemap useful: format and limits, sitemap index files, which URLs to list, accurate lastmod, submission, extensions and auditing.

An XML sitemap is one of the few places where you tell search engines directly which URLs you care about. It is also easy to get subtly wrong. A sitemap full of redirects, noindexed pages or `lastmod` dates that change every night sends the opposite of the message you intended, and nothing breaks loudly enough for anyone to notice.

The rules themselves are not complicated. They come from two places: the [sitemaps.org protocol](https://www.sitemaps.org/protocol.html), which defines the format, and each search engine's documentation, which says how it uses that format. Mixing the two up is where most bad advice comes from, so this guide keeps them apart.

You will learn the format and its hard limits, when to use a sitemap index, which URLs belong in a sitemap, how Google treats `lastmod`, `changefreq` and `priority`, how to submit and monitor sitemaps, and when the image, video, news and language extensions are worth it.

**Key takeaways**

- A sitemap helps search engines discover URLs and choose canonicals. It doesn't guarantee that anything is crawled or indexed.
- Each file: at most 50,000 URLs and 50 MB uncompressed, UTF-8, with absolute, entity-escaped URLs on the same host and protocol as the sitemap.
- List only the canonical URLs you want in search results: status 200, indexable, not redirected.
- Google uses lastmod only when it is consistently accurate, and ignores changefreq and priority.
- Submit the sitemap in Search Console and reference it in robots.txt. Google's old "ping" endpoint no longer works.

## What a sitemap does, and what it doesn't

Google describes a sitemap as a file that tells search engines which pages and files you think are important, with information such as when a page was last updated and its alternate language versions ([Learn about sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview)). Search engines read it to crawl your site more efficiently. Google is equally clear about the limit: a sitemap helps discover URLs but "doesn't guarantee that all the items in your sitemap will be crawled and indexed".

A sitemap also feeds canonicalization. Google lists sitemap inclusion as a weak signal that helps the listed URLs become canonical, next to the stronger signals of redirects and `rel="canonical"`. That is the main reason the sitemap should list your preferred URLs and nothing else.

Do you need one? Google says you probably do if your site is large, new with few external links, or rich in video, images or news. You might not if the site has about 500 pages or fewer, every important page is reachable through internal links, and you don't rely on media or news results. Many CMSs already generate one, so the practical question is often whether the sitemap you have is correct.

## The format and its hard limits

A valid XML sitemap needs very little: a `<urlset>` root with the sitemaps.org namespace, and a `<url>` entry with a `<loc>` for each page. Everything else is optional.

*sitemap.xml*

```
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/guides/xml-sitemaps/</loc>
    <lastmod>2026-10-28</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/catalog?item=12&amp;color=blue</loc>
    <lastmod>2026-10-02T09:30:00+00:00</lastmod>
  </url>
</urlset>
```

Note the `&amp;` in the second URL: like any XML, sitemap values must be entity-escaped. These are the rules that decide whether a sitemap is valid and usable, and where each comes from:

| Rule | Requirement | Source |
| --- | --- | --- |
| Size per file | At most 50,000 URLs and 50 MB (52,428,800 bytes) uncompressed. Gzip is allowed, but the limit applies after decompression. | Protocol, Google |
| Encoding | UTF-8. Escape `&`, `'`, `"`, `<` and `>` as entities. | Protocol |
| `<loc>` | Absolute URL starting with the protocol, under 2,048 characters. Google crawls URLs exactly as listed. | Protocol, Google |
| Scope | Same protocol and host as the sitemap, at or below its directory. URLs outside the scope are dropped. | Protocol |
| Location | Google recommends the site root. Unless submitted through Search Console, a sitemap affects only URLs below its own directory. | Google |
| `<lastmod>` | W3C Datetime, such as `2026-10-28` or a full timestamp with time zone. The date the page changed, not the date the file was generated. | Protocol |
| `<changefreq>`, `<priority>` | Optional hints in the protocol. Google ignores both. | Protocol, Google |
| URL order | Doesn't matter to Google. | Google |

> **Note:** The namespace URI starts with `http://`, not `https://`, and that is correct. Google's Search Central blog notes that it is a reference for XML parsers, not a link, and works as intended.

Google also accepts RSS, Atom and plain-text sitemaps ([Build and submit a sitemap](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap)). Only XML supports the image, news and language extensions (feeds can describe videos through mRSS, and text files list nothing but URLs), which makes XML the most versatile choice.

## Large sites: split with a sitemap index

When you pass 50,000 URLs or 50 MB, split the sitemap and list the parts in a sitemap index. The index uses the same namespace and the same limits, and you can submit just the index file.

*sitemap_index.xml*

```
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://www.example.com/sitemaps/articles.xml.gz</loc>
    <lastmod>2026-10-30</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://www.example.com/sitemaps/products.xml.gz</loc>
    <lastmod>2026-10-31</lastmod>
  </sitemap>
</sitemapindex>
```

- Referenced sitemaps must be on the same site as the index and, per Google's index guidance, in the same directory or lower, unless you set up cross-site submission.
- In an index, <lastmod> is the time the sitemap file changed, not its pages. The protocol notes that this lets crawlers fetch only the sitemaps that changed.
- Google accepts up to 500 sitemap index files per site in Search Console.

How you split is up to you. Splitting by section or content type (articles, products, locales) pays off later: Google notes that separate sitemaps let you track each one in Search Console, and the Page indexing report can be filtered by sitemap, so you can see at a glance which part of the site isn't getting indexed.

## Which URLs belong in a sitemap

Google's rule is short: include the URLs you want to see in Google's search results, which generally means the canonical URLs. If the same content is reachable under several URLs, list the one you prefer. Everything that follows is that rule applied.

**Include**

- Canonical URLs that return 200.
- Pages you want indexed, with no noindex rule.
- The HTTPS version of each URL, on your preferred host.
- One version of a page that has separate mobile and desktop URLs, unless you annotate both.

**Leave out**

- URLs that redirect: list the final URL instead.
- Pages with noindex, or blocked by robots.txt or a login.
- 404, 410 and 5xx URLs.
- Duplicates such as tracking parameters, sort orders and session IDs.

Two of Google's canonicalization rules apply directly here: don't list the HTTP version of your pages in a sitemap, and don't name one URL as canonical in the sitemap and a different one with `rel="canonical"` on the page ([How to specify a canonical URL](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls)). And when Google's Page indexing report explains error spikes, it names this exact mistake: a submitted sitemap that includes URLs blocked by robots.txt, noindex or a login.

After a migration or URL change, regenerate the sitemap so it lists the new final URLs; our guide to [301 vs 302 redirects](https://backlnk.com/blog/301-vs-302-redirects) covers the redirects themselves. If sitemap URLs show up as not indexed, our guide to [finding why a page is not indexed](https://backlnk.com/blog/page-not-indexed) walks through each status.

## lastmod, changefreq and priority

Of the three optional tags, only one matters to Google. Its documentation says it "ignores `<priority>` and `<changefreq>` values" and uses `<lastmod>` "if it's consistently and verifiably (for example by comparing to the last modification of the page) accurate".

What counts as a modification? Google means the last *significant* update: a change to the main content, the structured data or the links on the page qualifies; a new copyright year or a sidebar change does not. In its 2023 post [announcing the end of sitemap pings](https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping), Google added that it uses `lastmod` as a signal for scheduling recrawls of known URLs, that it's fine to leave the tag out for pages whose change date your software can't tell, such as a home page or category page, and that if `lastmod` keeps claiming changes that didn't happen, "eventually we're not going to believe you anymore".

> **Common myth:** "Setting `priority` to 1.0 and `changefreq` to daily makes Google crawl a page more often." Google says it doesn't use either value at all. What it does document using is an accurate `lastmod` on pages that really changed.

*Illustrative example:* A CMS rebuilds `sitemap.xml` every night and stamps every entry with the build date, so all 8,000 URLs of `example.com` show `<lastmod>2026-10-31</lastmod>`, including pages untouched for years. The fix is to read each page's real last-edit date from the database, write it only when the main content, structured data or links changed, and omit the tag for aggregate pages where no single date is true.

## Submit the sitemap and watch it

Submitting a sitemap only tells Google where it is; you can't upload one, and Google calls submission "merely a hint". There are two ways that work for everyone, and both are worth doing.

1. **Publish it where Google can fetch it.** Ideally at the site root, without a login, and not blocked by robots.txt: Google respects robots.txt when fetching sitemaps, and a blocked sitemap shows *Couldn't fetch*.
2. **Test the URL.** The [Sitemaps report](https://support.google.com/webmasters/answer/7451001) help suggests a live URL inspection of the sitemap URL and checking that *Page fetch* is Successful.
3. **Reference it in robots.txt.** Add a `Sitemap:` line with the full URL. You can list several, and this works even if you don't have owner permissions in Search Console.
4. **Submit it in Search Console.** Paste the URL into *Add a new sitemap* in the Sitemaps report (owner permissions required), or use the Search Console API.
5. **Read the status.** *Success*, *Has errors* (URLs that parsed are still queued) or *Couldn't fetch*. *Discovered pages* counts the URLs Google parsed, with duplicates counted once.
6. **Check indexing per sitemap.** Filter the Page indexing report by the sitemap to see how many of its URLs are indexed and why the rest aren't.

*robots.txt*

```
User-agent: *
Disallow: /search

Sitemap: https://www.example.com/sitemap_index.xml
Sitemap: https://www.example.com/sitemaps/news.xml
```

> **Watch out:** Remove any code that still "pings" Google with your sitemap URL. Google deprecated the ping endpoint in 2023, and requests to it now return a 404. They do no harm, but they don't do anything either; robots.txt and Search Console are the supported routes.

A few behaviors of the report are worth knowing. It lists only sitemaps submitted through the report or the API, not ones found through robots.txt. Removing a sitemap from the report doesn't make Google forget it or its URLs. And after a successful read, Google recrawls the sitemap on its own schedule, so resubmitting is only worth it after big changes.

## Extensions for images, video, news and language versions

Google supports four extensions that add information to a `<url>` entry. Image, video and news tags can live in a separate sitemap or inside your existing one; Google says either is fine.

| Extension | Namespace | What it adds | Key rule |
| --- | --- | --- | --- |
| Image | `http://www.google.com/schemas/sitemap-image/1.1` | Images on a page, especially ones Google might not find, such as images loaded by JavaScript | Up to 1,000 `<image:image>` per URL. Caption, title, geo location and license tags are deprecated. |
| Video | `http://www.google.com/schemas/sitemap-video/1.1` | Details of videos on a page, such as thumbnail and title | Every referenced file must be accessible to Googlebot; don't list videos unrelated to the page. |
| News | `http://www.google.com/schemas/sitemap-news/0.9` | Publication name and language, publication date and title of news articles | Only articles from the last two days; up to 1,000 `<news:news>` tags per sitemap. |
| Language versions | `http://www.w3.org/1999/xhtml` | `<xhtml:link rel="alternate" hreflang="…">` for each language or region version | Every `<url>` lists all versions including itself; these child links don't count toward the URL limit. |

Sources: Google's [image](https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps), [video](https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps) and [news](https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap) sitemap guides and its guide to [localized versions](https://developers.google.com/search/docs/specialty/international/localized-versions). One limitation to plan around: the Sitemaps report doesn't currently show data for image, video or news URLs.

## Audit your sitemaps with Backlnk

Search Console tells you whether Google could read a sitemap, but not whether the URLs inside it are the right ones. Backlnk's free [Sitemap Hygiene Auditor](https://backlnk.com/tools/sitemap-auditor) checks both sides. Give it a website and it finds the sitemaps through the robots.txt `Sitemap:` lines or `/sitemap.xml`, or give it a sitemap URL directly. It reads XML sitemaps and sitemap indexes, including gzip files, up to 20 files and 50,000 URLs, and reports:

- Per-file validity, namespace and protocol limits.
- Relative URLs, URLs outside each sitemap's scope and URLs listed more than once.
- lastmod format, future dates and the distribution of values, flagging identical dates for review.
- A deterministic sample of up to 40 destinations, checked for status, redirects, canonical and noindex.
- A CSV export of the results.

To see what that looks like on a large, well-kept sitemap, we ran the auditor on `developer.mozilla.org` on 2026-10-31. Its robots.txt lists one sitemap index, which points to ten per-locale sitemaps (English, German, Spanish, French, Japanese, Korean, Brazilian Portuguese, Russian and two Chinese variants).

- **67,445** — URLs listed across 10 per-locale sitemaps
- **3%** — share of the most common exact `lastmod` value among 49,690 dated URLs
- **40 of 40** — sampled URLs answered successfully, with no redirects

Because the total exceeds the tool's 50,000-URL limit, the auditor analyzed 50,000 URLs and said so in its coverage notes. Among them, every `lastmod` used W3C Datetime, none was in the future, and the values were spread across 50 different months, which is consistent with real edit dates rather than a build timestamp. The sitemaps use neither `priority` nor `changefreq`. The report raised two points to review: one URL listed twice, and one sampled URL whose page carries `noindex`. Small drifts like these are exactly what a periodic audit is for.

Keep the tool's scope in mind: a sample verifies destinations, not every URL, and the auditor doesn't infer what Google has indexed. Use the Page indexing report, filtered by sitemap, for that.

## Next step

Run your site through the [Sitemap Hygiene Auditor](https://backlnk.com/tools/sitemap-auditor), remove every redirecting, noindexed or erroring URL it finds, and fix `lastmod` if every entry carries the same date. Then confirm the sitemap is referenced in robots.txt and submitted in Search Console, and check its indexed share in the Page indexing report a few weeks later.

## Frequently asked questions

### Does every website need an XML sitemap?

No. Google says a site with about 500 pages or fewer that is fully linked internally and does not rely on media or news results might not need one. Large sites, new sites with few external links and sites with a lot of video, images or news benefit most.

### Does Google use priority and changefreq?

No. Google's documentation says it ignores both values. It uses lastmod when the dates are consistently and verifiably accurate, so keep lastmod truthful and leave the other two out if you like.

### Should noindex or redirected URLs be in my sitemap?

No. List only the canonical URLs you want in search results, returning 200 and without noindex. Google names submitted sitemaps that include URLs blocked by robots.txt, noindex or a login as a cause of error spikes in the Page indexing report.

### How many URLs can one sitemap contain?

Up to 50,000 URLs and 50 MB uncompressed per file. For more, split the URLs into several sitemaps and list them in a sitemap index file, which has the same limits.

### Do I still need to ping Google when my sitemap changes?

No. Google deprecated the sitemap ping endpoint in 2023 and requests to it now return a 404 error. Reference the sitemap in robots.txt and submit it in Search Console; Google periodically recrawls sitemaps it has read successfully.

## Sources

- [Sitemaps XML format](https://www.sitemaps.org/protocol.html), sitemaps.org (accessed 2026-10-31)
- [Learn about sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview), Google Search Central (accessed 2026-10-31)
- [Build and submit a sitemap](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap), Google Search Central (accessed 2026-10-31)
- [Manage your sitemaps with a sitemap index file](https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps), Google Search Central (accessed 2026-10-31)
- [Sitemaps ping endpoint is going away](https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping), Google Search Central Blog (accessed 2026-10-31)
- [Sitemaps report](https://support.google.com/webmasters/answer/7451001), Google Search Console Help (accessed 2026-10-31)
- [Page indexing report](https://support.google.com/webmasters/answer/7440203), Google Search Console Help (accessed 2026-10-31)
- [How to specify a canonical URL with rel="canonical" and other methods](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls), Google Search Central (accessed 2026-10-31)
- [Image sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps), Google Search Central (accessed 2026-10-31)
- [Video sitemaps and alternatives](https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps), Google Search Central (accessed 2026-10-31)
- [News sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap), Google Search Central (accessed 2026-10-31)
- [Tell Google about localized versions of your page](https://developers.google.com/search/docs/specialty/international/localized-versions), Google Search Central (accessed 2026-10-31)
