A sitemap validator reads your sitemap.xml and tells you whether search engines can parse it: well formed XML, the right namespace, absolute URLs, valid dates and a file within the protocol limits of 50,000 URLs and 50 MB uncompressed. Paste your file or its URL into the free XML sitemap validator, fix every error it lists, then resubmit the sitemap in Google Search Console.
Validation is only half the job. A sitemap can be perfectly valid XML and still be useless, because it lists redirects, noindex pages or URLs on the wrong host. That is what a sitemap checker is for: the free sitemap checker finds your sitemap from robots.txt or /sitemap.xml, counts its URLs, follows sitemap indexes and flags URLs on the wrong host or over the limits. This guide covers both, plus how to generate the file in the first place and how to get it in front of Google and Bing.
What an XML sitemap is (and is not)
An XML sitemap is a file that lists the URLs you want search engines to crawl, optionally with the date each one last changed. It follows the protocol published at sitemaps.org, which Google, Bing and the other major engines all read.
Three things a sitemap does not do:
- It does not force indexing. Google treats the list as suggestions. Whether a page gets into the index still depends on its quality, its canonical tag and whether it is blocked. Our glossary entry on indexing explains the crawl, index, rank sequence.
- It is not a ranking factor. Listing a page does not make it rank higher.
- It does not replace internal links. Pages that nothing links to are weak even when they are in the sitemap.
Who needs one most? New sites with few backlinks, sites with thousands of pages, sites that add pages often (a launch directory, a blog, a store) and pages that sit deep in the navigation. A five page marketing site will be found without one, but a sitemap costs nothing and gives you the Sitemaps report in Search Console, which is worth having on its own.
The sitemap protocol limits
These are the hard limits from the protocol. A sitemap validator should fail a file that breaks any of them.
| Rule | Limit | What to do if you hit it |
|---|---|---|
| URLs per sitemap file | 50,000 | Split into several files and list them in a sitemap index |
| File size | 50 MB uncompressed | Split the file; gzip saves bandwidth but the limit applies to the uncompressed size |
| Sitemaps per index file | 50,000 | Use more than one index and submit each one |
| URL length in loc | Under 2,048 characters | Shorten the URL or leave it out |
| Encoding | UTF-8 | Save the file as UTF-8 and escape special characters |
One rule people miss: the location of the sitemap limits what it can list. A sitemap at https://example.com/blog/sitemap.xml may only list URLs that start with https://example.com/blog/. Put your sitemap at the root of the host and this never bites. The same goes for hosts and protocols: a sitemap on https://www.example.com should not list URLs on http://example.com.
Required and optional sitemap tags
Here is a minimal valid sitemap with one page:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/pricing</loc>
<lastmod>2026-11-12</lastmod>
</url>
</urlset>
| Tag | Required? | What Google does with it |
|---|---|---|
| urlset | Yes (the root) | Must carry the namespace http://www.sitemaps.org/schemas/sitemap/0.9 |
| url | Yes, one per page | Wraps each entry |
| loc | Yes | The absolute URL, including https:// |
| lastmod | No | Used when it is consistently accurate |
| changefreq | No | Ignored |
| priority | No | Ignored |
lastmod is the only optional tag worth your time
Google has said publicly that it ignores priority and changefreq. It does use lastmod, but only when the dates prove trustworthy over time. That means lastmod should change when the main content of the page changes, not when a footer year updates or a sidebar widget refreshes. Two patterns tell Google your dates are fake: every URL showing today's date, and dates in the future. Use the W3C date format, either a plain date (2026-11-12) or a full timestamp with a time zone (2026-11-12T09:30:00+00:00).
Escaping special characters
A sitemap is XML, so five characters must be escaped inside loc: the ampersand as &, the single quote as ', the double quote as ", the less than sign as < and the greater than sign as >. The ampersand is the one that breaks real sitemaps, because URLs with query strings contain it. A single bare ampersand makes the whole file invalid, and Google reports a parsing error instead of reading the URLs that come before it.
Sitemap index files
A sitemap index is a sitemap of sitemaps. You need one when you pass 50,000 URLs, and it is a good idea well before that, because splitting by page type (pages, blog, launches, products) lets you see in Search Console which section has indexing problems.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-pages.xml</loc>
<lastmod>2026-11-12</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-blog.xml</loc>
</sitemap>
</sitemapindex>
Rules for the index: the root element is sitemapindex, not urlset; each child is a sitemap element with its own loc; an index lists sitemaps, never other indexes; and the child sitemaps normally live on the same host as the index. Submit the index and the engines find the rest.
How to generate a sitemap XML file
There are three ways to generate sitemap XML, and the best one depends on how your site is built.
1. Let your framework or CMS build it
This is the right answer for most sites, because the sitemap stays current without anyone remembering to update it. WordPress has had a built-in sitemap at /wp-sitemap.xml since version 5.5, and SEO plugins replace it with their own. Next.js lets you export a sitemap function from app/sitemap.ts that returns your URLs. Shopify, Webflow, Ghost and most hosted builders generate one automatically. Your job is to check the output, not write it.
2. Use an XML sitemap generator for small or static sites
For a landing page, a docs site on static hosting or a quick fix while you set up the automatic version, paste your URLs into the free XML sitemap generator. It takes one full https:// address per line, can add today's date as lastmod, escapes the URLs correctly and gives you a sitemap.xml to download and upload to your site's root. Remember to regenerate it when you add pages.
3. Build an index when you have several files
If your framework writes one sitemap per section, or you split a large file, list the parts with the sitemap index generator: paste the sitemap URLs, add optional lastmod dates and save the result as sitemap_index.xml. To resize existing files, the sitemap split and merge tool splits one big sitemap into smaller parts with an index, or merges several into one with duplicate URLs removed.
How to validate a sitemap, step by step
Run these checks after every change to how your sitemap is built, and once a month otherwise.
- Validate the XML. Load the file in the sitemap validator. It checks the XML is well formed, the namespace is right, every loc is an absolute URL, every lastmod is a valid date, the file is within the limits and no URL is listed twice. Each problem is shown with the entry it is in, so you can fix it at the source.
- Check discovery. Run the site through the sitemap checker. If it cannot find your sitemap from robots.txt or /sitemap.xml, neither can a crawler that has never visited.
- Count the URLs. The number should roughly match the number of pages you want indexed. Far more usually means filter pages, tag archives or paginated lists slipped in. Far fewer means sections are missing.
- Check the URLs themselves. Every listed URL should return 200, be the canonical version of the page and not carry a noindex. Spot check a sample: run a few through a redirect checker and look at their canonical tags. Our canonical tag guide covers what a correct canonical looks like.
- Compare with Search Console. After submitting, the Sitemaps report shows how many URLs Google discovered from each file, and the Pages report filtered by sitemap shows how many were indexed.
Common sitemap errors and how to fix them
| Problem | Why it happens | Fix |
|---|---|---|
| Parsing error or invalid XML | A bare ampersand, a stray character before the XML declaration, or HTML mixed into the output | Escape ampersands, make sure nothing prints before the declaration |
| Sitemap is HTML | The URL returns a web page, often a 404 page or a login screen | Serve the real XML file with a 200 status |
| Couldn't fetch | robots.txt blocks the sitemap, the server times out, or the URL is wrong | Open the sitemap URL in a private window and check robots.txt |
| URL not allowed | The sitemap lists URLs on another host, protocol or path above its own folder | Move the sitemap to the root and list only same-host URLs |
| Invalid date | lastmod in a format like 12/11/2026, or a time without a time zone | Use 2026-11-12 or a full W3C timestamp |
| Redirecting or noindex URLs | The generator lists every route it knows about | List only canonical, indexable URLs that return 200 |
| Every lastmod is today | The build stamps the build date on every URL | Use each page's real content update date, or leave lastmod out |
The last two are the ones a validator alone will not catch, because the XML is fine. They waste crawl attention and teach Google to distrust your sitemap, which is why it pays to run the checker as well as the validator.
How to submit a sitemap to Google and Bing
Add it to robots.txt
Add one line anywhere in your robots.txt with the absolute URL of the sitemap or the index. You can list several.
User-agent: *
Disallow: /admin/
Sitemap: https://example.com/sitemap.xml
Every engine that reads robots.txt finds the sitemap this way, including ones you never submit to by hand. If you are starting from scratch, the robots.txt generator builds a valid file with the Sitemap line included. Never disallow the sitemap's own path, or crawlers cannot fetch it.
Submit in Google Search Console
- Verify your site in Search Console, preferably as a Domain property so every subdomain and protocol is covered.
- Open Indexing, then Sitemaps.
- Enter the sitemap or index URL and press Submit.
- Come back after a day or two. The status should read Success, with a count of discovered URLs. Open the sitemap to see any errors per file.
Google retired its old sitemap ping endpoint in 2023, so submitting in Search Console and listing the sitemap in robots.txt are the two ways to tell Google about it. After that, Google refetches the sitemap on its own schedule; you do not need to resubmit after every change. Our guide on how to get a website indexed by Google covers the rest of the process, including the URL Inspection tool for single urgent pages.
Submit in Bing Webmaster Tools
Bing has its own Sitemaps section in Bing Webmaster Tools, and you can import a verified site straight from Search Console. Bing powers several other search products, so it is worth the five minutes.
IndexNow: the faster path for Bing and others
A sitemap waits to be fetched. IndexNow pushes: when you publish, update or delete a page, you send the URL to one endpoint and the participating engines (Bing, Yandex, Seznam, Naver and others) all hear about it. You prove ownership with a key file at the root of your site, and one request can carry up to 10,000 URLs on the same host. Google does not use IndexNow, so keep your sitemap accurate either way. The IndexNow tester generates a key, checks that the key file is live at the right URL and gives you the exact request to send.
Ready to check your own file? Run it through the free sitemap validator for XML errors, then the sitemap checker for discovery, URL counts and hosts.
FAQ
How do I check if my sitemap is valid?
Paste the file or its URL into a sitemap validator. It checks the XML is well formed, the namespace is correct, every loc is an absolute URL, dates use the W3C format and the file stays within 50,000 URLs and 50 MB. Then check the Sitemaps report in Google Search Console, which shows whether Google could read it.
Where should my sitemap be located?
At the root of your host, usually https://yoursite.com/sitemap.xml, so it can list any URL on that host. Add a Sitemap line to robots.txt pointing to it and submit it in Search Console.
Do priority and changefreq matter for SEO?
Not for Google, which ignores both. They are allowed by the protocol and harmless to include. lastmod is the optional tag that matters, and only if the dates reflect real content changes.
How many URLs can a sitemap have?
Up to 50,000 URLs and 50 MB uncompressed per file. Above that, split the URLs across several sitemaps and list them in a sitemap index, which can itself reference up to 50,000 sitemaps.
Should noindex or redirected pages be in my sitemap?
No. List only canonical pages that return a 200 status and that you want indexed. Redirects, noindex pages, duplicates and error pages send mixed signals and make Google trust the whole file less.
How long does Google take to read a new sitemap?
It varies. Google often fetches a newly submitted sitemap within a few days, but crawling and indexing the URLs in it can take much longer for a new site. Check the Sitemaps report for the last read date and the number of discovered URLs.
Topics
Written by
Devvrat Hans
Founder
By subscribing, you agree to get our newsletter by email. Unsubscribe any time in one click. See our Privacy policy and Terms.
Related Articles
301 Redirect Generator Guide: 301 vs 302, and Redirect Code for Apache, Nginx, Next.js and Cloudflare
How to use a 301 redirect generator, and when a 301 is the right redirect at all: 301 vs 302 vs 307 vs 308, copy and paste code for .htaccess, Nginx, Next.js and Cloudflare, and how to avoid chains and loops in a migration.
Bulk Domain Authority Checker: How to Compare Many Domains at Once (Free)
When to check domain authority in bulk, how to compare up to 20 domains at once for free, how to read and sort the results, and a link prospecting workflow with spreadsheet formulas.
Canonical Checker Guide: What a Canonical Tag Does and How to Check Yours
How to use a canonical checker, and what it is checking for: what rel canonical means, HTML and HTTP header examples, when to use a canonical tag, the mistakes that drop pages from Google and how to read Search Console's canonical reports.