How to create an XML sitemap (and submit it)
A sitemap won’t make a page rank, but a clean one helps search engines find new and changed pages quickly and gives you per-section indexing reports. Here is how to build one that does its job.
1. Decide what belongs in it
List the canonical, indexable URLs you want in search results — nothing else. Leave out:
- URLs that redirect or return 4xx/5xx;
- pages with
noindex(meta tag orX-Robots-Tagheader); - duplicates whose
rel=canonicalpoints to another URL — parameter variants, print views, tracking-tagged links; - URLs blocked by robots.txt (a sitemap listing them sends mixed signals);
- internal search results, cart and account pages.
The creator’s crawler applies all of these rules and shows the reason for every exclusion.
2. Write the XML
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-10-30</lastmod>
</url>
<url>
<loc>https://example.com/pricing?plan=team&cycle=yearly</loc>
</url>
</urlset>- The file must be UTF-8 and the namespace exactly
http://www.sitemaps.org/schemas/sitemap/0.9. <loc>is a full absolute URL, under 2,048 characters, with&written as&and spaces or non-ASCII characters percent-encoded.<lastmod>is optional and uses W3C Datetime:2026-10-30or2026-10-30T14:05:00+05:30. A time without a timezone is invalid.<changefreq>and<priority>are optional and ignored by Google. Skip them unless another consumer needs them.
3. Get lastmod right
Google uses lastmod as a crawl hint only when it has proven accurate for your site. Set it to the date the main content last changed — not the build date, not today’s date for every URL, and not when a sidebar widget updated. If you cannot produce real dates, leave lastmod out; a missing date is better than a misleading one. The validator warns when every URL carries the same date.
4. Mind the limits: split and index
One sitemap holds at most 50,000 URLs and 50 MB uncompressed (gzip is allowed for transfer). Larger sites split into several files and list them in a <sitemapindex>, which can reference up to 50,000 sitemaps. Splitting by section — pages, blog, products — also makes Search Console reports easier to read. The creator splits automatically; the splitter and index generator handle files you already have.
5. Add extensions where they help
- Images — for product and gallery images, especially when loaded by script or from a CDN.
- Video — thumbnail, title, description and a content or player URL are required.
- News — articles from the last two days only, up to 1,000 per file.
- Hreflang — language and regional versions, with every version listing every other, itself included.
6. Publish and submit
- Upload the file(s) to your site, normally the root:
https://example.com/sitemap.xml. A sitemap can only list URLs at or below its own folder unless you submit it in Search Console. - Add
Sitemap: https://example.com/sitemap.xmltorobots.txt(generator). - Submit it in Google Search Console → Indexing → Sitemaps, and in Bing Webmaster Tools. Google retired the anonymous “ping” endpoint in 2023; resubmitting is unnecessary — Google re-reads sitemaps it knows about.
- Check the Page indexing report per sitemap after a few days. “Submitted URL not selected as canonical” or “Excluded by noindex” mean the sitemap lists URLs it shouldn’t.
Common mistakes
- Unescaped
&in URLs — the whole file fails to parse. - The https namespace (
https://www.sitemaps.org/…) instead of http. - Listing http and https, or www and non-www, versions together.
- Serving the sitemap behind a login, a redirect to the home page, or with an HTML error page and status 200.
- Every URL stamped with the same lastmod.
- Relative URLs such as
/about.
Ready? Create your sitemap or check an existing one.