How to Generate an XML Sitemap (and Submit It)
Build a valid XML sitemap for your site, add it to robots.txt, and submit it to Google Search Console so every page gets discovered. A clear step-by-step guide.
An XML sitemap is a machine-readable list of the URLs on your site that you want search engines to crawl and index. It doesn't guarantee indexing, but it gives crawlers a complete map of your pages, invaluable for large sites, new sites with few backlinks, and pages that aren't well linked internally.
You don't need a plugin or CMS to make one. A sitemap is just a specific XML format any tool can produce. This guide walks through generating a valid sitemap, hosting it at the right URL, pointing robots.txt at it, and submitting it to Google Search Console so your pages get discovered faster.
This guide uses XML Sitemap Generator
Free, private and instant. Open it now and follow along with the steps below.
Follow these steps
Step 1: Gather the URLs you want indexed
Collect the canonical, public URLs you want search engines to crawl, skip admin pages, duplicate parameter URLs, and anything set to noindex. Include only pages that return a 200 status.
Step 2: Generate the sitemap
Open the XML sitemap generator, add your URLs, and let it build a valid <urlset> document. Each entry gets a <loc>, and you can add optional <lastmod>, <changefreq> and <priority> hints.
Step 3: Set accurate lastmod dates
Where you can, give each URL a truthful last-modified date. Google largely ignores changefreq and priority but does use a reliable lastmod to prioritise recrawling changed pages, so keep it honest.
Step 4: Save the file as sitemap.xml
Download the generated file and name it sitemap.xml. If you have more than 50,000 URLs or the file exceeds 50 MB uncompressed, split it into multiple sitemaps and list them in a sitemap index.
Step 5: Upload it to your site root
Place the file at the root of your domain so it's reachable at https://yourdomain.com/sitemap.xml. Load that URL in a browser to confirm it serves valid XML with a 200 status.
Step 6: Reference it in robots.txt
Add a line like 'Sitemap: https://yourdomain.com/sitemap.xml' to your robots.txt file. This lets any crawler discover the sitemap automatically without you submitting it manually.
Step 7: Submit it in Google Search Console
In Search Console, open the Sitemaps report, enter the sitemap URL and submit it. Google will fetch it, report how many URLs it read, and flag any parsing errors.
Tips & best practices
- Only include canonical URLs: listing both a page and its duplicate sends mixed signals about which version to index.
- Keep the sitemap in sync with your site: remove URLs that now 404 or redirect, since a sitemap full of dead links erodes crawler trust.
- Use absolute URLs with the correct protocol (https) and host, relative paths aren't valid in a sitemap.
- For very large or frequently changing sites, automate sitemap generation so it always reflects the current set of live pages.
Related tools
Robots.txt Generator
Build a valid robots.txt with user-agent groups, allow/disallow rules, crawl-delay, sitemap and host directives, with live output, presets and lint warnings. 100% in your browser.
Robots.txt Validator
Paste your robots.txt to parse it into User-agent groups and catch the mistakes that block Google: a stray Disallow: /, rules before any User-agent, unknown directives and a missing sitemap. 100% in your browser.
Meta Tag Generator
Generate perfect SEO meta tags, Open Graph and Twitter Card markup with a live Google snippet and social-card preview, copy the ready-to-paste <head> code, 100% in your browser.
Schema Markup Generator
Generate valid JSON-LD structured data for Article, FAQ, Product, Organization, LocalBusiness, Event and more, with a live rich-results validity check and a copy-ready script tag. 100% in your browser.
Related how-to guides
- How to Compress a PDF (Free, In Your Browser)Shrink a large PDF in seconds. No software, no upload, no watermark. A simple step-by-step guide to reducing PDF file size while keeping it readable.5 steps
- How to Merge PDF Files Into One (Free, No Upload)Combine several PDFs into a single document in seconds: reorder pages, no software, no watermark. A step-by-step guide to merging PDF files in your browser.6 steps
- How to Add a Watermark to a PDF (Text or Image)Stamp DRAFT, CONFIDENTIAL or your logo across every page of a PDF, control the opacity, angle and position. A quick, private, browser-based guide.6 steps