Technical SEO April 4, 2026 · 5 min read

How to Create an XML Sitemap (Step by Step)

Learn how to create a valid XML sitemap, validate it for errors, add it to your robots.txt, and submit it to Google Search Console to get pages indexed faster.

Advertisement

What is an XML sitemap?

An XML sitemap is a file that lists all the important URLs on your website. It acts as a roadmap for search engines — telling Google exactly which pages exist, when they were last updated, and how often they change.

Without a sitemap, Google has to discover your pages by following links. With a sitemap, you give Google a direct list of every page you want indexed — which means faster discovery, especially for new or recently updated content.

🗺️ Free Tools

Generate and validate your XML sitemap for free — no software needed.

What does an XML sitemap look like?

An XML sitemap is a structured file that follows the sitemap protocol. Here is a basic example:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://yoursite.com/</loc>
    <lastmod>2026-04-01</lastmod>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://yoursite.com/blog/</loc>
    <lastmod>2026-04-01</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
</urlset>

The four key tags explained:

<loc>The full URL of the page — required
<lastmod>Date the page was last updated (YYYY-MM-DD format)
<changefreq>How often the page changes: daily, weekly, monthly
<priority>Relative importance 0.0–1.0 (homepage = 1.0)
Advertisement

Step-by-step: Create and submit your sitemap

1
Generate your sitemap

Use our XML Sitemap Generator. Paste all your important URLs — one per line. Set changefreq to weekly and priority to 0.8 for most pages, 1.0 for your homepage.

2
Validate your sitemap

Use our Sitemap Validator to check for errors before uploading. It checks for missing <urlset> tags, duplicate URLs, and invalid structure.

3
Upload to your site root

Save the file as sitemap.xml and upload it to your site root so it's accessible at https://yoursite.com/sitemap.xml.

4
Add it to robots.txt

Add Sitemap: https://yoursite.com/sitemap.xml to the bottom of your robots.txt file. This lets all crawlers find it automatically.

5
Submit to Google Search Console

Go to Google Search Console → Sitemaps → Add a new sitemap. Enter your sitemap URL and click Submit. Google will crawl it within a few days.

What pages should you include?

Homepage, about, contact, and main landing pages
All published blog posts and articles
Product pages and category pages
Admin, login, cart, and checkout pages
Pages with noindex meta tags
Duplicate or thin content pages

Priority values guide

1.0Homepage — highest priority
0.8Main category pages and important landing pages
0.6Blog posts and regular content pages
0.4Tag pages, author archives, and supplementary pages

Key takeaways

Every website needs an XML sitemap — especially sites with 10+ pages
Only include indexable pages — exclude admin, login, and noindex pages
Add your sitemap URL to robots.txt and submit to Google Search Console
Update your sitemap whenever you add new pages or delete old ones

Create your XML sitemap now

Free tool — paste your URLs and download a valid sitemap.xml in seconds.

Open XML Sitemap Generator →
← Robots.txt Explained Next: On-Page SEO Checklist →
Advertisement