What are the best practices for XML sitemaps?

Include only canonical, indexable URLs.
Keep it under 50k URLs or 50MB per file split into multiple if needed.
Update timestamps when content changes.
Don’t include noindex or duplicate pages.
Submit the sitemap in Google Search Console/Bing Webmaster Tools.
That’s basically it clean structure + regular updates = best results.
 
Keep it under 50k URLs or 50MB per file split into multiple if needed.
I would say 1k URLs per xml sitemap
a few years ago it was said that google would only read the first few thousand links of xml sitemaps, so 1k urls is a good target
 
I would say 1k URLs per xml sitemap
a few years ago it was said that google would only read the first few thousand links of xml sitemaps, so 1k urls is a good target
Good points. The official spec allows up to 50k URLs or 50MB per file, but in practice smaller sitemaps like 1k URLs each are easier to manage and ensure faster processing. As long as you keep them clean, regularly updated, and submitted in Search Console, both approaches work fine.
 
Good points. The official spec allows up to 50k URLs or 50MB per file, but in practice smaller sitemaps like 1k URLs each are easier to manage and ensure faster processing. As long as you keep them clean, regularly updated, and submitted in Search Console, both approaches work fine.
you can write a php/python code to do that for you. Pretty easily done
 
you can write a php/python code to do that for you. Pretty easily done
That makes sense, thanks! Splitting into smaller sitemaps definitely seems easier to manage. I hadn’t thought about automating it with a simple PHP/Python script I’ll look into that. Do you have any preferred approach or script example you’ve used?
Would appreciate any pointers if you’ve tried one that works well.
 
For mine, keep sitemaps simple, include only important pages, use HTTPS, update regularly, validate XML, submit to Google & Bing, and reference in robots.txt. Use a sitemap index for large sites.
 
What are the best practices for XML sitemaps?
Here are the best practices for XML sitemaps (straight to the point):

  1. Include only indexable URLs – Don’t list nonindexed, redirected, or duplicate pages.
  2. Keep it clean & updated – Add new pages and remove deleted ones regularly.
  3. Stay within limits – Max 50,000 URLs or 50 MB per sitemap; use a sitemap index if needed.
  4. Use correct tags – <loc>, <lastmod>, <changefreq>, <priority> (optional, but <loc> and <lastmod> are most useful).
  5. Canonical URLs only – Ensure the listed URLs match your preferred canonical version.
  6. Submit to Google & Bing – Through Google Search Console and Bing Webmaster Tools.
  7. Place sitemap in root – e.g., example.com/sitemap.xml for sitewide coverage.
  8. Use HTTPS – Only list secure URLs if your site uses HTTPS.
  9. Separate by type if large – e.g., one sitemap for blog posts, another for products, etc.
  10. Compress if needed – Use .gz if the file is very large.
 
Here are the best practices for XML sitemaps (straight to the point):

  1. Include only indexable URLs – Don’t list nonindexed, redirected, or duplicate pages.
  2. Keep it clean & updated – Add new pages and remove deleted ones regularly.
  3. Stay within limits – Max 50,000 URLs or 50 MB per sitemap; use a sitemap index if needed.
  4. Use correct tags – <loc>, <lastmod>, <changefreq>, <priority> (optional, but <loc> and <lastmod> are most useful).
  5. Canonical URLs only – Ensure the listed URLs match your preferred canonical version.
  6. Submit to Google & Bing – Through Google Search Console and Bing Webmaster Tools.
  7. Place sitemap in root – e.g., example.com/sitemap.xml for sitewide coverage.
  8. Use HTTPS – Only list secure URLs if your site uses HTTPS.
  9. Separate by type if large – e.g., one sitemap for blog posts, another for products, etc.
  10. Compress if needed – Use .gz if the file is very large.
Thanks a lot for sharing these concise sitemap best practices—super clear and to the point, really helpful for keeping things optimized!
 
That makes sense, thanks! Splitting into smaller sitemaps definitely seems easier to manage. I hadn’t thought about automating it with a simple PHP/Python script I’ll look into that. Do you have any preferred approach or script example you’ve used?
Would appreciate any pointers if you’ve tried one that works well.
I think you can even submit xml sitemaps through api so its automated 100%
 
Simple, I just used rank math plugin for sitemap, its automatically index all my link. Install rank math and forget about all manual work.
 
Keep only clean, indexable urls, split big sitemaps into smaller ones, and submit through gsc or bing faster crawling.
 
Only put indexable URLs, keep it updated, split if site is big, and submit it in GSC. Clean + simple works best. No need to overcomplicate sitemaps.
 
The size should not exceed 50k URLs in a single sitemap file. And no more than 50 megabytes in weight. If it’s more, split it into several files and create a sitemap index.
 
Back
Top