How to create an XML sitemap
An XML sitemap provides search engines with a structured list of URLs that you want them to discover. This guide explains what an XML sitemap is, why it is useful, what to include, and how to submit it to search engines.
Try the XML Sitemap GeneratorHow to create an XML sitemap
An XML sitemap provides search engines with a structured list of URLs that you want them to discover. This guide explains what an XML sitemap is, why it is useful, what to include, and how to submit it to search engines.
What is an XML sitemap?
An XML sitemap is a file that lists the URLs on your website that you want search engines to crawl and index. It uses a standard format defined by the sitemaps.org protocol, with each URL wrapped in a <url> element inside a <urlset> container.
A basic sitemap looks like this:
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://example.com/</loc> </url> <url> <loc>https://example.com/about</loc> </url> </urlset>Each URL entry can also include optional metadata such as last modification date, change frequency, and priority.
Why use an XML sitemap?
An XML sitemap helps search engines discover the URLs on your website. It is particularly useful for:
- New websites that have few external links pointing to them.
- Large websites with many pages that might be missed during normal crawling.
- Websites with frequently changing content, where the lastmod tag helps crawlers prioritise.
- Websites with pages that are not well linked from other pages.
A sitemap does not guarantee that your pages will be indexed or ranked. It is a discovery aid, not a ranking signal.
What should be included?
Include important canonical, indexable URLs that you want search engines to crawl and index. In general:
- Include your homepage and key content pages.
- Include canonical URLs, not duplicate or alternate versions.
- Include pages that are linked from other sites or internal navigation.
Avoid including:
- Private or password-protected pages.
- Login pages.
- Duplicate URLs.
- Search result pages.
- URLs blocked by robots.txt.
- Non-canonical duplicate versions of the same content.
XML Sitemap vs HTML Sitemap
An XML sitemap and an HTML sitemap serve different purposes:
- An XML sitemap is a machine-readable file designed for search engine crawlers. It lists URLs in a structured XML format and is not intended for human visitors.
- An HTML sitemap is a human-readable page on your website that lists links to your main pages. It helps visitors navigate your site and can also help crawlers discover URLs.
You can have both. They complement each other and serve different audiences.
Sitemap vs Robots.txt
Sitemap.xml and robots.txt serve different purposes:
- robots.txt provides instructions to crawlers about which parts of your site they should and should not crawl. It controls crawler access.
- sitemap.xml provides a list of URLs that you want search engines to discover. It helps crawlers find your pages.
They work together. You can reference your sitemap in robots.txt using the Sitemap directive, so crawlers can find your sitemap easily. Use the Robots.txt Generator to create a robots.txt file that includes your sitemap URL.
How to submit sitemap.xml
To submit your sitemap to search engines:
- Generate a valid sitemap.xml file using the XML Sitemap Generator.
- Upload sitemap.xml to the root directory of your website so it is accessible at https://example.com/sitemap.xml.
- Sign in to Google Search Console and add your website property if you have not already.
- Go to Sitemaps in Search Console and submit your sitemap URL.
- You can also reference your sitemap in robots.txt using the Sitemap directive.
Generating a sitemap does not automatically submit it to Google or any other search engine. You need to submit it through the search engine's webmaster tools. SolveWithTools.com does not have access to your Google Search Console account.
Try these tools
XML Sitemap Generator
Generate a valid XML sitemap for your website. Add URLs manually or scan a website, set priorities and change frequencies, validate your sitemap and download sitemap.xml.
Use toolRobots.txt Generator
Generate a valid robots.txt file for your website. Control which crawlers can access parts of your site and add your XML sitemap URL.
Use toolSERP Preview
Preview how your SEO title, URL and meta description could appear in Google search results. Optimise your search snippet before publishing.
Use toolMeta Title & Description Checker
Check your SEO meta title and description for character length, pixel width, truncation risk and keyword presence. Optimise your search snippets before publishing.
Use toolOpen Graph Preview
Preview how your webpage could appear when shared on Facebook, LinkedIn and X. Check your Open Graph title, description and image before publishing.
Use toolSchema Markup Generator
Generate Schema.org JSON-LD structured data for Articles, Products, Local Businesses, FAQs, Organisations, Breadcrumbs and Events. Create structured data ready to add to your website.
Use toolFrequently asked questions
What is an XML sitemap?+
An XML sitemap is a file that lists the URLs on your website that you want search engines to crawl and index, using the standard sitemaps.org protocol format.
How many URLs can an XML sitemap contain?+
A single XML sitemap can contain up to 50,000 URLs and must not exceed 50 MB uncompressed. For more URLs, use multiple sitemap files and a sitemap index.
Where should I upload sitemap.xml?+
Upload it to the root directory of your website so it is accessible at https://example.com/sitemap.xml.
Does an XML sitemap improve SEO?+
A sitemap helps search engines discover your URLs but does not guarantee indexing or ranking improvements. It is a discovery aid, not a ranking signal.
What is the difference between sitemap.xml and robots.txt?+
sitemap.xml provides a list of URLs for search engines to discover. robots.txt provides instructions to crawlers about which parts of your site they should and should not crawl.