Skip to main content
SEO DOST

Technical SEO

XML Sitemaps for SEO: How to Create, Validate, and Submit Them

Updated: · Published: · 4 min read · SEO DOST Editorial

An XML sitemap is a machine-readable file that lists the canonical pages on your website you want search engines to discover and index. Google, Bing, and Yandex use sitemaps to find new and recently updated URLs more efficiently. Submitting a sitemap does not guarantee indexing, but it dramatically improves URL discovery on large, newly launched, frequently updated, or deeply nested websites.

Why XML Sitemaps Matter

Sitemaps surface important pages that crawlers might otherwise miss or take weeks to reach by following internal links alone. They are especially valuable when:

  • Your website is brand new and has few external backlinks pointing to it.
  • Your site hosts thousands of product pages, listings, or editorial articles.
  • Some sections have sparse internal linking or deep category structures.
  • You publish or update pages frequently and want crawlers to notice changes quickly.

Even on small, tightly linked sites, maintaining a clean XML sitemap pays off because it unlocks dedicated coverage diagnostics inside Google Search Console.

XML Sitemap Rules and Limits

A single XML sitemap file may contain up to 50,000 URLs and must not exceed 50 MB uncompressed. Larger sites split URLs across multiple child sitemaps and reference them all inside a sitemap index file.

Rule Requirement
URL limit Maximum 50,000 URLs per sitemap file
File size limit Maximum 50 MB uncompressed
Character encoding UTF-8
URL format Fully qualified canonical URLs (including https://)
lastmod tag Update only when page content changes meaningfully
priority and changefreq Ignored by Google

Which Pages Belong in Your Sitemap?

List only indexable, canonical pages that return an HTTP 200 status code. Including noindex pages, 301/302 redirects, 404 errors, or non-canonical parameter URLs sends conflicting signals to crawlers and muddies Search Console reporting. If you need to pull unwanted pages out of Google's index properly, follow our guide to removing pages from Google.

Using the lastmod Tag Correctly

The <lastmod> element signals when a page's primary content last changed meaningfully. Google uses lastmod when it observes that a site keeps those dates accurate and trustworthy. Automatically bumping every URL's timestamp daily — or updating it for minor template tweaks — degrades signal reliability and causes crawlers to ignore the tag.

How to Generate an XML Sitemap

Most modern platforms generate and maintain XML sitemaps automatically, so hand-coding XML is rarely necessary:

  • WordPress: Includes a built-in sitemap at /wp-sitemap.xml since version 5.5, and dedicated WordPress SEO plugins offer finer control over post types and exclusions.
  • Laravel and custom applications: Generate XML dynamically from your database via a dedicated route, scheduled job, or sitemap package so newly published URLs appear automatically.
  • Shopify, Wix, and hosted platforms: Create and update /sitemap.xml automatically whenever products or pages change.
  • Static site generators: Build clean sitemaps at compile time through standard sitemap plugins.

You can also deploy specialized extensions for images, videos, and Google News articles when relevant. Multilingual websites can include xhtml:link hreflang annotations inside sitemaps as an alternative or complement to HTML head tags.

How to Submit Your Sitemap to Search Engines

Once your XML sitemap is live and returning valid XML, notify search engines through three standard channels:

  1. Declare it in robots.txt: Add a Sitemap: https://example.com/sitemap.xml line to your root robots file — you can verify syntax using our robots.txt Generator.
  2. Submit it in Google Search Console: Open the Sitemaps report and enter your sitemap path; see our Google Search Console guide for full setup details.
  3. Add it to Bing Webmaster Tools and Yandex Webmaster: Both search engines also support the IndexNow protocol for instant URL change notifications.

Google deprecated its legacy sitemap ping endpoint in 2023, so declaring the sitemap in robots.txt and submitting it through Search Console are now the sole official methods for Google.

Auditing and Fixing Sitemap Errors

Keeping a sitemap healthy matters just as much as creating it. Search Console's Sitemaps report flags unreadable XML, HTTP fetch errors, and the exact count of discovered URLs. If there is a wide gap between submitted URLs and indexed pages, inspect the Pages report to see whether crawlers are encountering noindex tags, canonical mismatches, or soft 404s.

You can validate your live sitemap structure, HTTP status codes, and child sitemap indexes immediately with our Sitemap Checker, or review crawlability, canonicals, and technical health together in our free SEO Audit.

Frequently Asked Questions

Will Google index my website without an XML sitemap?
Yes. Google can still discover and index pages by following internal and external links. However, an XML sitemap speeds up discovery on new or large sites and makes tracking indexing issues in Search Console much easier.
Do priority and changefreq tags still matter for SEO?
No. Google has explicitly stated that it ignores both `priority` and `changefreq` values in XML sitemaps. Clean canonical URLs and truthful `lastmod` timestamps matter far more.
Can a website have multiple XML sitemaps?
Yes. Websites exceeding 50,000 URLs or 50 MB — or teams that prefer separating blog posts, products, and category pages — can maintain multiple sitemaps and group them inside a single sitemap index file.
What is the difference between an XML sitemap and an HTML sitemap?
An XML sitemap is a structured file formatted specifically for search engine crawlers. An HTML sitemap is a standard web page designed to help human visitors browse a site's hierarchy and sections.