How to Create an XML Sitemap and Submit It to Google

Key takeaways
- Search engines discover pages two ways.
- These two get mixed up constantly.
- Most sites already have one.
- Not every site needs every type.
An XML sitemap is a file that lists every important page on your website. It tells search engines what exists on your site and when each page last changed. Without one Google has to guess your structure by crawling links alone. That works for small sites. It breaks down fast on larger ones.
A sitemap does not guarantee rankings. It does not force Google to index every page. What it does is remove guesswork. It hands search engines a clean map instead of leaving them to stumble through your site on their own. That single difference can speed up discovery by days or weeks depending on site size.
Google introduced the sitemap protocol back in 2005 and the format has barely changed since. The rules are simple once you see them written down.
This guide covers what a sitemap does, the formats Google accepts the exact file rules how to build one on any platform, how to submit it to Google and Bing and how to confirm it is working.
What an XML Sitemap Actually Does
Search engines discover pages two ways. They follow links from page to page. Or they read a sitemap that lists URLs directly. Both matter but a sitemap adds a layer of certainty that link crawling alone cannot offer.
Why Search Engines Rely on It
Confirms which URLs you consider important enough to be found
Signals when a page was last updated so crawlers know when to revisit
Helps large or new sites get crawled faster since there is less to discover organically
Surfaces orphan pages that have no internal links pointing to them
Gives AI search systems and answer engines a structured list of content to reference
When a Sitemap Matters Most
Your site has more than a few hundred pages
You publish new content often and want faster discovery
Your internal linking is inconsistent or still being built out
You run an ecommerce store with product pages that change stock or pricing
You recently launched a new domain with no existing crawl history
When You Can Skip One
You probably do not need a sitemap if your site has under 100 pages and every page is reachable through normal internal links. Google will find everything on its own. Adding a sitemap still does no harm and takes minutes, so most people add one anyway.
XML Sitemap vs HTML Sitemap
These two get mixed up constantly. They serve different audiences.
Factor | XML sitemap | HTML sitemap |
Built for | Search engine crawlers | Human visitors |
Visible on site | No | Yes |
Format | XML markup file | A normal web page with links |
Main job | Speed up discovery and indexing | Help people find pages |
Needed today | Yes for most sites | Rarely |
HTML sitemaps were common a decade ago. Good navigation and sensible internal linking replaced them for most sites. XML sitemaps stayed relevant because crawlers still use them.
Check If You Already Have a Sitemap
Most sites already have one. Check before you build anything.
Three Quick Ways to Find It
Open your browser and visit yoursite.com/sitemap.xml
If that returns nothing try yoursite.com/sitemap_index.xml or yoursite.com/wp-sitemap.xml
Open yoursite.com/robots.txt and look for a line starting with Sitemap:
Shopify, Wix, Squarespace, Webflow and WordPress all generate one automatically. If any of those URLs load a file full of links you already have a sitemap and your job shifts to cleaning it up rather than creating it.
Types of XML Sitemaps You Should Know
Not every site needs every type. Most business websites only need a standard page sitemap. Knowing the other formats helps you decide what applies.
Common Sitemap Formats
Standard sitemap = lists regular web pages such as service pages and blog posts
Image sitemap = lists images you want indexed separately in image search
Video sitemap = used when video is central to a page and needs its own metadata
News sitemap = required for sites approved for Google News and updated frequently
Sitemap index = a file that points to several smaller sitemaps on large sites
Most agencies and small business sites never touch news or video sitemaps. If you run a service business, a blog or an online store the standard page sitemap is the only one worth getting right.
File Formats Google Will Accept
XML is not your only option. Google reads four formats.
Format | Best for | Limitation |
XML | Almost everything | Slightly more verbose |
RSS or Atom feed | Sites where the CMS already outputs a feed | Only shows recent URLs |
mRSS | Video content | Video focused |
Plain text .txt | Very simple sites | One URL per line and no extra data |
A plain text sitemap is literally a list of full URLs with nothing else in the file. It works but you lose lastmod so most sites stay on XML.
XML Sitemap Rules and Limits You Must Follow
Break these and Google either rejects the file or silently ignores parts of it.
Hard Limits
Rule | Limit |
URLs per sitemap file | 50,000 |
File size uncompressed | 50MB |
Sitemaps per index file | 50,000 |
Length of a single URL | Under 2,048 characters |
Compression | Gzip allowed but the uncompressed size still counts |
Formatting Rules
The file must be UTF-8 encoded
Every URL must be absolute and fully qualified like https://example.com/page and never /page
Special characters must be escaped so & becomes & and ' becomes '
Only list canonical URLs you actually want appearing in search
Keep the protocol consistent so an https sitemap lists only https URLs
Where the File Is Allowed to Live
A sitemap can only cover URLs at or below its own folder. A file sitting at example.com/shop/sitemap.xml can list example.com/shop/product-a but not example.com/blog/post-a. Put the file in your root directory and this problem disappears.
All URLs must also sit on the same host. A subdomain like shop.example.com needs its own sitemap.
How to Create an XML Sitemap
This is the part most people overcomplicate. You rarely need to write XML by hand anymore. The method depends on what your site runs on. Learning how to create XML Sitemap files properly still helps even when a plugin does the work for you because you will know what to fix when the output looks wrong.
Option 1: Let Your CMS Generate It Automatically
WordPress builds one by default since version 5.5 at yoursite.com/wp-sitemap.xml with no plugin at all
Yoast SEO or Rank Math replace that core file with a richer version at sitemap_index.xml
Shopify creates a sitemap automatically at yoursite.com/sitemap.xml
Webflow, Wix and Squarespace generate one once the site goes live
These files update on their own whenever you add or remove a page
One catch on WordPress. If Discourage search engines from indexing this site is ticked under Settings> Reading, the sitemap returns a 404. Untick it before you go hunting for bugs.
Option 2: Build One With a Static Site or Custom Framework
Use a generator library that fits your stack such as next-sitemap for Next.js projects
Run it inside your build step so the file refreshes on every deploy
Confirm the output is publicly reachable at yoursite.com/sitemap.xml
For single page apps make sure the generator renders JavaScript or your sitemap will miss routes that only appear after scripts run
Option 3: Use a Crawler or Sitemap Generator Tool
A crawler walks your site the way a search engine would then exports the result. Useful when your platform has no built-in option.
What a good crawler leaves out by default:
Pages returning 3XX 4XX or 5XX responses
URLs blocked in robots.txt
Pages carrying a noindex tag
URLs that canonicalise to a different page
Paginated pages and PDF files
Those defaults exist for a reason. Override them only when you know why.
Option 4: Write the XML by Hand
Worth doing once even if you never do it again. The structure is short.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-09-14</lastmod>
</url>
<url>
<loc>https://example.com/services/</loc>
<lastmod>2026-08-30</lastmod>
</url>
</urlset>
What Each Part Does
<?xml version...?> declares the file type and encoding
<urlset> wraps everything and points to the protocol version
<url> opens one page entry
<loc> holds the page address and is the only required tag
<lastmod> records when that page last changed in YYYY-MM-DD format
Save it as sitemap.xml and upload it to your root folder through your host file manager or FTP.
Understanding lastmod, changefreq and priority
Three optional tags cause more confusion than the rest of the file combined. Here is what each one is worth today.
What the Tags Mean
Tag | Accepted values | Does Google use it |
lastmod | A date like 2026-09-14 | Yes, when the dates are accurate |
changefreq | always, hourly, daily, weekly, monthly, yearly, never | No |
priority | 0.0 to 1.0 with 0.5 as default | No |
What This Means in Practice
Google has said plainly it ignores changefreq and priority. Both were good ideas that site owners abused by marking everything as hourly and 1.0.
lastmod is different. Google uses it only when the dates are consistently and verifiably accurate. Stamp today's date on every page and Google stops trusting the signal entirely. Update the date only when the page content genuinely changed. A tweak to a copyright year does not count.
Simplest approach for most sites. Keep lastmod accurate. Drop the other two.
What to Include and Exclude From Your Sitemap
A sitemap filled with the wrong pages can slow indexing down. Quality beats volume here.
Pages Worth Including
Core service and product pages
Published blog posts and resource pages
Category and collection pages that hold real content
Location pages if you serve multiple cities or regions
Pages to Leave Out
Pages blocked by robots.txt
Duplicate content or thin filter combinations on ecommerce sites
Pages marked noindex
Login pages, cart pages and internal admin routes
Redirected URLs that point elsewhere
URLs carrying session IDs or tracking parameters
Keeping the file clean tells Google every URL listed is one you want indexed. Some owners assume more URLs means more chances to rank. The opposite happens. A padded sitemap spends crawl budget on pages that were never going to perform. Treat it as a curated list not a full site export.
A Quick Way to Audit What You Already Have
Export your current sitemap and compare it against your live page count
Open a sample of URLs directly and flag anything that redirects or errors
Strip out parameter heavy URLs that duplicate an existing page
Run a free SEO audit to catch indexing and crawl issues the sitemap alone will not reveal
Recheck every quarter as pages get added and retired
How to Split Large Sitemaps With an Index File
Once you pass 50,000 URLs or 50MB you need more than one file. Most large sites split well before that just to stay organised.
How to Split
Break files by content type rather than at random.
post-sitemap.xml for blog content
page-sitemap.xml for static pages
product-sitemap.xml for store items
category-sitemap.xml for collections
Splitting this way makes Search Console reporting far more useful because you can see indexing rates per content type instead of one blended number. Stores running thousands of SKUs feel this immediately and it is a standard part of serious ecommerce development work.
What the Index File Looks Like
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/post-sitemap.xml</loc>
<lastmod>2026-09-14</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/product-sitemap.xml</loc>
<lastmod>2026-09-12</lastmod>
</sitemap>
</sitemapindex>
You then submit only the index file to Google. It finds the rest on its own.
How to Add Your Sitemap to robots.txt
This is the step people skip. It takes one line and it helps every crawler not just Google.
The Line You Need
Sitemap: https://example.com/sitemap.xml
Drop it anywhere in your robots.txt file. It works independently of any user-agent rules above or below it. You can list more than one sitemap by adding another line.
Bing, Yandex, DuckDuckGo and most AI crawlers read robots.txt. This single line makes your sitemap discoverable to all of them without any manual submission.
How to Submit Your Sitemap to Google
Creating the file is half the job. Submitting through Google Search Console puts it in front of Google directly and gives you a report to check later.
Step by Step Submission Process
Sign in to Google Search Console and pick your verified property
Open Sitemaps in the left sidebar
Type the path such as sitemap.xml into the field
Click Submit and wait for Google to fetch the file
Return after a few hours and confirm the status reads Success
Compare the discovered URL count against your real page count to spot gaps
Other Ways to Submit
Add the Sitemap: line to robots.txt as shown above
Use the Search Console API if you publish at high volume and want submission automated
Use WebSub if you run an RSS or Atom feed and want changes broadcast instantly
After Submission
Discovery and indexing are separate stages so nothing appears instantly
Revisit the Sitemaps report to catch fetch errors and unreachable URLs
Resubmit after any migration or URL restructure
Keeping this checked month after month is part of ongoing website maintenance rather than a one-time task
How to Submit Your Sitemap to Bing
Bing powers its own results plus Yahoo and several AI assistants. Skipping it leaves traffic on the table.
Open Bing Webmaster Tools and sign in
Import your site straight from Google Search Console if it is already verified there
Open Sitemaps and choose Submit sitemap
Paste the full sitemap URL and confirm
Bing also accepts the robots.txt line so a single edit covers it if you would rather not create an account.
How to Validate a Sitemap Before You Submit It
A broken file wastes days. Check it first.
What to Check
The file loads in a browser without errors
The XML declaration sits on line one with UTF-8 encoding
Every <loc> holds a full URL starting with https
Ampersands and quotes are escaped properly
No URL returns a redirect or an error when opened
The file sits under 50,000 URLs and 50MB
Every listed URL lives on the same host and protocol as the sitemap
Search Console flags most of these after submission but catching them early saves a round trip.
Common XML Sitemap Mistakes That Hurt Indexing
Even a well built sitemap can undercut itself with small errors. These show up in almost every technical audit.
Mistakes to Watch For
Listing pages that return a 404 or redirect somewhere else
Including noindexed pages which sends Google two opposite signals at once
Forgetting to update the file after a migration or URL change
Mixing http and https versions of the same URL
Leaving the Sitemap: line out of robots.txt
Stamping today's date as lastmod on every page
Listing non-canonical variants alongside the canonical page
Submitting once and never opening the report again
How to Check If Google Indexed Your Sitemap Pages
Submitting is not the finish line. Confirming indexing is where most site owners stop too early.
Ways to Verify Indexing Status
Use URL Inspection in Search Console for individual pages
Open the Pages report under Indexing to compare indexed against excluded URLs
Run a site:yourdomain.com search for a rough count
Track indexed totals against your sitemap URL count each month
How Long It Usually Takes
Google normally fetches a submitted sitemap within a few hours. Indexing the pages inside it takes longer. Small sites often settle within two weeks. Large sites take longer because crawl budget gets spread thinner. A page that is still unindexed after a month usually has a content or quality problem rather than a sitemap problem.
Sitemaps in the Age of AI Search
Traditional crawlers were the only audience for years. That changed. AI assistants answer engines and Google AI Overviews all need to know what exists on your site before they can quote it.
Why This Matters Now
AI crawlers respect robots.txt so the Sitemap: line helps them map your site too
Accurate lastmod dates help systems pick current pages over stale ones
Clean sitemaps with only canonical URLs reduce the chance of a model quoting a duplicate or dead page
A sitemap split by content type makes it obvious which parts of your site carry real depth
A sitemap will not get you cited on its own. It removes the friction that stops your best pages from being found in the first place. That groundwork sits underneath all modern GEO and answer engine optimisation work and it is where Digisutra Solutions starts on every technical engagement before touching content strategy.
Conclusion
An XML sitemap is one of the simplest technical SEO jobs you can finish and one of the most ignored. Most platforms build it for you. The real work is keeping it clean, submitting it properly and checking the report afterwards. Fix the file put the line in robots.txt and confirm indexing. Get those three right and your pages get found faster with far less guesswork on Google's end.
FAQ
Do I need an XML sitemap for a small website?
Not always. Sites under 100 pages with solid internal linking usually get indexed without one. Submitting a sitemap still speeds up discovery and costs nothing.
How often should I update my sitemap?
It should update automatically whenever pages are added, removed or changed. Most CMS platforms handle this without manual work.
Where should my sitemap file be located?
The root of your domain at yoursite.com/sitemap.xml. WordPress uses wp-sitemap.xml by default and SEO plugins often use sitemap_index.xml.
How do I find my existing sitemap?
Try /sitemap.xml then /sitemap_index.xml then /wp-sitemap.xml in your browser. If none load open your robots.txt and look for a line beginning with Sitemap:.
Can I have more than one sitemap?
Yes. Large sites use a sitemap index file that points to several smaller sitemaps split by content type.
How many URLs can one sitemap hold?
50,000 URLs or 50MB uncompressed whichever comes first. Past that you need multiple files and an index.
Does Google use the priority and changefreq tags?
No. Google ignores both. Only lastmod carries weight and only when your dates are genuinely accurate.
Does submitting a sitemap guarantee indexing?
No. It tells Google which pages exist and helps crawling. Indexing still depends on content quality and site authority.
What is the difference between an XML and HTML sitemap?
An XML sitemap is a file built for crawlers and hidden from visitors. An HTML sitemap is a normal page with links built for people.
What is the difference between a sitemap and robots.txt?
A sitemap lists pages you want crawled. Robots.txt tells crawlers which areas to stay out of. They work together.
How do I add my sitemap to robots.txt?
Add a single line reading Sitemap: https://yoursite.com/sitemap.xml anywhere in the file. It works regardless of the user-agent rules around it.
How long does Google take to process a sitemap?
Fetching usually happens within hours. Full indexing of the URLs inside takes days to weeks depending on site size and crawl budget.
Should I include images and PDFs in my sitemap?
Only if you want them found in search. Most business sites only need core web pages listed.
What happens if my sitemap has broken links?
Search Console reports the errors. A high error rate reduces trust in the file over time so clear them quickly.
Do I need to submit my sitemap to Bing separately?
Bing Webmaster Tools gives you reporting and lets you import your site from Search Console in a click. The robots.txt line alone also works if you skip the account.
Can I submit a sitemap without Google Search Console?
Yes, through robots.txt. Search Console is still better because it shows you fetch errors and indexing counts.
About the author

Sr. SEO Executive · 3 years' experience
Harsh Rajput is a Senior SEO Executive with 3+ years of experience in SEO, digital marketing and AEO/GEO strategy. He leads a team of SEO executives at Digisutra Solutions, handling keyword research, technical SEO, on-page/off-page optimization, link building and content strategy, while helping brands rank in Google AI Overviews and LLM platforms like ChatGPT, Claude and Gemini. He has worked with clients across India, USA, UAE, and Australia in industries like e-commerce, finance and technology.
Reader reviews

Up next · SEO & AI search · 21 min
Technical SEO Audit Checklist Covering 47 Issues That Can Hurt Your Rankings

Related · SEO & AI search · 9 min
How to Rank Your Shopify Store Higher on Google
