What Is an XML Sitemap? How to Create and Submit One
An XML sitemap is a file that lists the pages on your website you want search engines to find. It sits at an address like yoursite.com/sitemap.xml and works like a table of contents for Google. It does not boost your rankings and it does not guarantee a page gets indexed, but it makes discovery faster and gives you a useful report on what Google did with each URL.
If you run a small site, a blog, or a brand-new site with few links pointing to it, a sitemap is one of the cheapest technical SEO jobs you can do. This guide explains what goes in the file, which parts Google now ignores, how to submit it, and how to fix the errors people hit most often.
What Is an XML Sitemap?
A sitemap is a plain file, written for machines, that lists your important URLs. Search engines normally find pages by following links. A sitemap gives them a direct list, so a page with no links pointing to it yet can still be discovered.
Google's documentation describes three supported formats and says it has no preference between them: XML, RSS/Atom feeds, and a plain text file with one URL per line. XML is the most flexible because it can also describe images, video and language versions of a page.
Do You Need a Sitemap?
Not every site does. Google says a sitemap helps most when your site is large, new, or has pages that are poorly linked to each other. A five-page site where every page is linked from the menu will usually be crawled fine without one.
It still costs almost nothing to have one, and the Search Console report alone is worth the effort. Add one if any of these apply:
- Your site is new and has few links from other websites.
- You publish often, such as a blog, and want new posts found quickly.
- Some pages are only reachable through search boxes or filters.
- Your site has hundreds or thousands of pages.
What Goes Inside a Sitemap File?
Each page gets one <url> entry. Only the address is required. The other tags are optional, and Google treats them differently:
| Tag | What it does | Does Google use it? |
|---|---|---|
<loc> | The full page address | Yes, required |
<lastmod> | Date the page last changed in a meaningful way | Only if it is consistently accurate |
<priority> | Your guess at a page's importance | No, ignored |
<changefreq> | How often you think it changes | No, ignored |
A minimal entry looks like this:
<url><loc>https://example.com/blog/my-post</loc><lastmod>2026-10-23</lastmod></url>
The practical lesson: do not spend time tuning priority or change frequency. Spend it on making sure the list of URLs is correct.
What Should You Include (and Leave Out)?
Treat the sitemap as a shortlist of pages you want people to find in search, not a dump of every URL. Google asks for canonical URLs, meaning the one preferred version of each page.
| Include | Leave out |
|---|---|
| Pages that return a normal 200 status | Pages that redirect or show errors |
| The canonical version of each page | Duplicate versions and tracking-parameter URLs |
| Pages you want in search results | Pages marked noindex |
| Blog posts, services, key landing pages | Thank-you pages, login pages, internal search results |
A clean sitemap sends a clear signal. A messy one full of redirects and blocked pages wastes crawl effort and fills your reports with warnings.
How to Create a Sitemap
The method depends on how your site is built:
- Website builders and CMS platforms. Most generate a sitemap automatically. Try adding
/sitemap.xmlto your address first. If a file loads, you already have one. - SEO plugins. If you use a CMS with an SEO plugin, switch its sitemap feature on and let it update itself.
- Small hand-built sites. For a few dozen pages you can write the file by hand in a text editor, following the example above, and save it as
sitemap.xmlin your site's root folder. - Large sites. Generate it automatically from your database or page list so it never goes stale.
A single sitemap file can hold up to 50,000 URLs or 50 MB uncompressed. Bigger sites split the list into several files and tie them together with a sitemap index file.
How to Submit a Sitemap to Google
There are two ways, and doing both is fine.
Option 1: Search Console
- Open Google Search Console and choose your verified property.
- Click Sitemaps in the left menu.
- Enter the sitemap address, usually
sitemap.xml, and click Submit. - Check that the status reads "Success" after a short while.
If you have not set Search Console up yet, our beginner's guide to Google Search Console walks through verification step by step.
Option 2: robots.txt
Add one line to your robots.txt file with the full address:
Sitemap: https://example.com/sitemap.xml
You can list several sitemaps, one line each. This also lets other search engines find the file without any account setup.
Does a Sitemap Improve Rankings?
No. Google describes a sitemap submission as a hint, not a command. It may help Google discover pages, but it does not decide where they rank or whether they are indexed. Page quality, relevance and links still do that work.
So if you submitted a sitemap and a page still is not appearing, the sitemap is rarely the problem. Our guide on why a website is not showing on Google covers the usual causes, from noindex tags to thin content.
Common Sitemap Errors and How to Fix Them
| Message | Likely cause | Fix |
|---|---|---|
| Couldn't fetch | Wrong address, or the file is blocked | Open the URL in a browser and confirm it loads |
| Sitemap is HTML | The address returns a web page, not XML | Point to the real XML file |
| Submitted URL has redirect | Listed URL moves somewhere else | List the final destination URL instead |
| Submitted URL marked noindex | Page tells Google not to index it | Remove the tag or drop the URL from the sitemap |
| Submitted URL not found (404) | Page was deleted | Remove it from the file |
After fixing, resubmit the sitemap or use the validate option in Search Console. Allow a few days for Google to recheck.
Sitemap Best Practices to Keep
- Keep it current. Add new pages when you publish and remove deleted ones.
- Use full, absolute addresses including
https://and the same domain version you use everywhere else. - Only use lastmod honestly. Update it when the main content changes, not when you tweak a footer.
- Check it monthly. A two-minute look at the Sitemaps report catches problems early.
- Save it as UTF-8 and escape special characters such as ampersands.
Sitemap vs robots.txt: What Is the Difference?
People often mix these two files up. They do opposite jobs. A sitemap says "here are the pages I would like you to look at". A robots.txt file says "here are the areas crawlers should stay out of". The two work together: robots.txt can also point crawlers to your sitemap, as shown above.
One thing to avoid is listing a page in your sitemap while blocking it in robots.txt. The two instructions contradict each other, and Search Console will flag it. Decide whether a page should be found or hidden, then make both files agree.
Frequently Asked Questions
Where is my sitemap located?
Usually at yourdomain.com/sitemap.xml. Also check your robots.txt file, which often lists the exact address.
How often should I update my sitemap?
Whenever you add, remove or significantly change pages. Automatic generation by your platform or plugin removes the chore.
Can I have more than one sitemap?
Yes. Large sites often split by section, such as posts and products, and list them in a sitemap index.
Is an HTML sitemap the same thing?
No. An HTML sitemap is a page for human visitors. An XML sitemap is a file for search engines. They serve different readers.
The Bottom Line
An XML sitemap is a simple list of your best pages, handed directly to search engines. Keep it accurate, submit it once in Search Console, add it to robots.txt, and check the report now and then. It will not rank your content for you, but it removes one common reason good pages go undiscovered.
Want a hand with the technical side of your site? Get in touch and we can look at it together.