Sitemap XML examples
Copy-ready examples of every sitemap format, with the parts that are required and the parts search engines skip.
All examples follow the sitemaps.org 0.9 protocol and Google's sitemap documentation. Files must be UTF-8 encoded, URLs must be absolute and entity-escaped, and each file may hold at most 50,000 URLs and 50 MB uncompressed.
Basic sitemap.xml
The shape 95% of sites need. <loc> is required; <lastmod> is optional but useful when accurate.
<?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-09-14</lastmod>
</url>
<url>
<loc>https://www.example.com/search?q=boots&size=42</loc>
<lastmod>2026-09-02T10:15:00+00:00</lastmod>
</url>
</urlset>All protocol tags
changefreq and priority are valid but Google ignores them. Allowed changefreq values: always, hourly, daily, weekly, monthly, yearly, never.
<url>
<loc>https://www.example.com/pricing</loc>
<lastmod>2026-09-20</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>Sitemap index
Lists other sitemaps. Required past 50,000 URLs or 50 MB per file. May not contain <url> entries or other indexes.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemaps/products-1.xml.gz</loc>
<lastmod>2026-09-26</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemaps/blog.xml</loc>
</sitemap>
</sitemapindex>Image sitemap
Only <image:loc> is still supported by Google. Up to 1,000 images per page.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
<url>
<loc>https://www.example.com/boots/trail-x</loc>
<image:image>
<image:loc>https://cdn.example.com/trail-x-side.jpg</image:loc>
</image:image>
</url>
</urlset>Video sitemap
thumbnail_loc, title, description, and content_loc or player_loc are required.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>https://www.example.com/guides/lacing</loc>
<video:video>
<video:thumbnail_loc>https://cdn.example.com/lacing.jpg</video:thumbnail_loc>
<video:title>How to lace hiking boots</video:title>
<video:description>Three lacing methods for steep descents.</video:description>
<video:content_loc>https://cdn.example.com/lacing.mp4</video:content_loc>
<video:duration>184</video:duration>
</video:video>
</url>
</urlset>News sitemap
Articles from the last 2 days only, max 1,000 per file.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
<url>
<loc>https://news.example.com/2026/09/27/trail-closures</loc>
<news:news>
<news:publication>
<news:name>The Example Ledger</news:name>
<news:language>en</news:language>
</news:publication>
<news:publication_date>2026-09-27T08:30:00+00:00</news:publication_date>
<news:title>Storm closes three alpine trails</news:title>
</news:news>
</url>
</urlset>hreflang in a sitemap
Each language version gets its own <url>, and each one lists every version including itself.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.example.com/boots/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/boots/"/>
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/stiefel/"/>
</url>
<url>
<loc>https://www.example.com/de/stiefel/</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/boots/"/>
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/stiefel/"/>
</url>
</urlset>Text sitemap
UTF-8, one absolute URL per line, nothing else. Max 50,000 lines / 50 MB.
https://www.example.com/
https://www.example.com/pricing
https://www.example.com/boots/trail-xPaste any of these into the validator to see it pass, then break it on purpose (remove the namespace, add a raw &) to see what the errors look like.
Questions people ask
What is the minimum valid sitemap?
<urlset> with the sitemaps.org namespace, and one <url> containing a <loc>. Everything else is optional.Do special characters need escaping?
& must be written &, and < > " ' as < > " '. Non-ASCII characters in paths should be percent-encoded, e.g. /caf%C3%A9.