An XML sitemap tells search engines which canonical public URLs on a site are worth crawling. Create or review one when important pages are slow to be discovered through normal internal links, when the URL inventory changes often, or when a migration needs one clean crawl source.
If your CMS or hosting platform already publishes a reliable sitemap, use that generated file instead of maintaining a second hand-written list. Current Google guidance recommends UTF-8 encoding, fully qualified canonical URLs, and a root-level sitemap URL when practical because a root sitemap can cover the whole host and is easy to reference from robots.txt or Search Console.
List only URLs that should appear in search, keep lastmod only when the date matches the page's last significant change, and skip changefreq and priority because Google ignores them. Submitting a sitemap is still only a crawl hint, so the file must stay publicly fetchable and in sync with the live canonical URLs.
If the site runs on a CMS or managed platform that already generates a sitemap, publish and review that file instead of hand-maintaining a separate XML list. Google says manual sitemaps are practical mainly for smaller, stable URL sets, while larger sites should generate them automatically.
Leave out redirects, alternate parameter URLs, staging hosts, login-only pages, blocked URLs, long-lived noindex pages, and other duplicates that should not compete as canonicals.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-04-20</lastmod>
</url>
<url>
<loc>https://www.example.com/contact/</loc>
</url>
</urlset>
loc is required, the URLs must be fully qualified and absolute, XML special characters must be entity escaped, and omitting lastmod is better than publishing a date you cannot keep true.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemaps/pages-1.xml.gz</loc>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemaps/pages-2.xml.gz</loc>
</sitemap>
</sitemapindex>
You can gzip child sitemap files, and the sitemap index is the single URL to submit when the site is split across multiple sitemap files.
https://www.example.com/sitemap.xml
A root sitemap can describe the whole host. If the file is published below the root and is discovered only through normal crawling, it affects only descendants of that parent directory.
Sitemap: https://www.example.com/sitemap.xml
If the site publishes a sitemap index, list the index URL here instead of each child sitemap.
Submitting a sitemap tells Google where the file lives; it does not upload the file for you. If you do not have owner permission for the property, keep the sitemap listed in robots.txt so Google can still discover it.
Do not rely on Google's old sitemap ping endpoint. Google deprecated it, and direct requests to that endpoint now return 404.
$ curl -I https://www.example.com/sitemap.xml HTTP/2 200 content-type: application/xml; charset=utf-8
If the site publishes a compressed sitemap, fetching the same URL may show a gzip content type or a Content-Disposition for sitemap.xml.gz. That is still acceptable as long as the published sitemap URL is the one you list in robots.txt and submit to Google.
If Google cannot fetch the file, test the sitemap URL with live inspection, then correct the property mismatch, access control, wrong host variant, stale lastmod values, or invalid XML before resubmitting.