XML Sitemap Generator
Generate properly formatted XML sitemaps to help search engines crawl your site
Add URLs
No URLs Added
Add URLs using the form above to generate your sitemap.
Generated Sitemap
<!-- Add URLs to generate your sitemap -->
Other Sitemap Types
About XML Sitemap Generator
An XML sitemap is a file that lists all the important URLs on your website, helping search engines like Google, Bing, and others discover and crawl your content efficiently. While search engines can find pages by following links, an XML sitemap ensures that every important page gets indexed — even those that aren't well linked internally or that were recently published.
XML sitemaps are one of the most fundamental SEO technical requirements for any website. They're especially critical for large sites with hundreds or thousands of pages, new sites that haven't built up strong internal linking yet, and sites with content that changes frequently. Google explicitly recommends submitting a sitemap through Google Search Console as one of the first steps in getting a new site indexed.
A properly structured XML sitemap includes not just URLs but also metadata about each page — when it was last modified, how frequently it changes, and its relative priority compared to other pages. This additional context helps search engines make smarter decisions about how often to crawl each page and which pages to prioritize.
What Makes a Good XML Sitemap
Not all XML sitemaps are created equal. A basic sitemap simply lists URLs, but a well-optimized sitemap provides rich metadata that helps search engines crawl your site more intelligently. The lastmod tag tells Google when a page was last updated — helping it prioritize re-crawling recently changed content. The changefreq tag signals how often a page typically changes. The priority tag (0.0 to 1.0) indicates relative importance within your site.
XML sitemaps have a size limit — each sitemap file can contain a maximum of 50,000 URLs and must be under 50MB uncompressed. Sites exceeding these limits need a sitemap index file that references multiple individual sitemaps. This is a common issue for large e-commerce sites and content platforms that generate sitemaps without checking against these limits.
Google also has specific recommendations about sitemap content: only include canonical URLs, exclude paginated pages beyond page 1, exclude URL parameters that don't change content, and avoid including URLs that return non-200 status codes. A bloated sitemap with low-quality URLs can actually harm your crawl budget by wasting it on pages that don't need frequent indexing.
Key Considerations
Sitemap Format and Encoding
XML sitemaps must be UTF-8 encoded and begin with the XML declaration. The urlset element must reference the correct namespace (http://www.sitemaps.org/schemas/sitemap/0.9). Special characters in URLs — ampersands, spaces, quotes — must be properly escaped as XML entities (&, %20, ") or the sitemap will fail validation.
lastmod Accuracy
The lastmod date should reflect when the page content actually changed, not when the sitemap was generated. Using today's date for all pages signals to Google that everything changed today — triggering unnecessary re-crawls. Accurate lastmod dates help Google allocate crawl budget efficiently and ensure recently updated content gets re-indexed promptly.
Priority Values
Priority (0.1 to 1.0) is relative to your own site — it doesn't affect ranking compared to other sites. Set your homepage at 1.0, main category/tool pages at 0.8-0.9, and sub-pages at 0.6-0.7. Avoid setting everything at 1.0 — Google ignores priority when all values are identical, defeating its purpose.
Canonical URLs Only
Only include canonical URLs in your sitemap. Never include URLs with UTM parameters, session IDs, or other tracking parameters. Never include paginated URLs beyond page 1 unless each page has truly unique content. Including non-canonical URLs in your sitemap confuses search engines about which version to index.
Common XML Sitemap Issues
Format and Validation Errors
- •Missing XML declaration or incorrect namespace causing sitemap rejection
- •Unescaped special characters (&, <, >, ', ") breaking XML parsing
- •Relative URLs instead of absolute URLs in loc tags
- •Sitemap exceeding 50,000 URL or 50MB limits without a sitemap index
- •Incorrect date format in lastmod — must be W3C Datetime (YYYY-MM-DD or full ISO 8601)
Content Quality Issues
- •Including 404, 301, or non-200 status code URLs in the sitemap
- •Including non-canonical URLs (with tracking parameters, session IDs)
- •Setting all priority values to 1.0, making the tag meaningless
- •Using today's date as lastmod for all pages regardless of actual update dates
- •Including noindex pages that should never be submitted to search engines
Submission and Discovery
- •Sitemap not referenced in robots.txt — search engines may not find it
- •Sitemap not submitted to Google Search Console or Bing Webmaster Tools
- •Sitemap URL uses HTTP when site is HTTPS
- •Sitemap file not accessible due to server configuration or authentication
Implementation Guide
Correct XML Sitemap Structure
A properly formatted XML sitemap with all recommended tags:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- Homepage — highest priority -->
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-02-28</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<!-- Main section pages -->
<url>
<loc>https://www.example.com/tools</loc>
<lastmod>2026-02-15</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<!-- Individual tool pages -->
<url>
<loc>https://www.example.com/tools/json-formatter</loc>
<lastmod>2026-01-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
</urlset>Next.js 15 Dynamic Sitemap Generation
Generate your XML sitemap programmatically in Next.js using the built-in sitemap API:
// app/sitemap.ts
import { MetadataRoute } from "next";
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = "https://www.example.com";
// Fetch dynamic pages from your CMS or database
const posts = await getPosts();
const staticPages = [
{
url: baseUrl,
lastModified: new Date(),
changeFrequency: "daily" as const,
priority: 1.0,
},
{
url: `${baseUrl}/tools`,
lastModified: new Date("2026-02-15"),
changeFrequency: "weekly" as const,
priority: 0.9,
},
];
const dynamicPages = posts.map((post) => ({
url: `${baseUrl}/blog/${post.slug}`,
lastModified: new Date(post.updatedAt),
changeFrequency: "monthly" as const,
priority: 0.7,
}));
return [...staticPages, ...dynamicPages];
}Add Sitemap to robots.txt
Reference your sitemap in robots.txt so all search engines can find it automatically:
# robots.txt
User-agent: *
Allow: /
# Always reference your sitemap
Sitemap: https://www.example.com/sitemap.xml
# For multiple sitemaps, reference the index
Sitemap: https://www.example.com/sitemap-index.xml
# Next.js robots.ts equivalent:
# app/robots.ts
import { MetadataRoute } from "next";
export default function robots(): MetadataRoute.Robots {
return {
rules: { userAgent: "*", allow: "/" },
sitemap: "https://www.example.com/sitemap.xml",
};
}Common Use Cases
- New site setup — submitting initial sitemap to Google Search Console
- Large sites with pages that lack strong internal linking
- E-commerce sites with hundreds of product pages
- Blogs and content sites that publish frequently
- Sites after migration to ensure all new URLs get indexed
Pro Tip
After generating your sitemap, submit it directly in Google Search Console under Sitemaps. GSC will show you how many URLs were submitted vs how many were indexed — a significant gap between these numbers indicates crawl or indexing issues worth investigating.