To create a sitemap, let your CMS generate one, or write an XML or plain text file listing the full canonical URL of every page you want indexed. Save it at your site root, keep it under 50,000 URLs or 50MB, then submit it in Google Search Console. Most small sites never need to build one by hand.
What is a sitemap?
A sitemap is a file that lists the pages on your site so search engines can find them. It is a hint, not an instruction. Google says it supports the formats defined by the sitemaps protocol, and it lists three that it accepts: XML, RSS or Atom feeds, and plain text. If you are not sure you need one at all, read do you need an XML sitemap first.
Which of the three ways should you use?
Choose by how many pages you have and what already generates them.
| Situation | Best method | Why |
|---|---|---|
| You use WordPress, Wix, Blogger or a similar platform | The built-in sitemap | It updates itself when you publish |
| A static site with a few dozen pages | A hand-written file | Google's guide says manual creation suits fewer than a few dozen URLs |
| A custom app or a large site | Generate it from your database | The list stays correct without anyone editing it |
Google's build and submit a sitemap guide gives the same three routes: let your CMS do it, write it manually for a small site, or have your software generate it from your URL data.
How do you check if your CMS already made one?
Before building anything, open your domain followed by /sitemap.xml in a browser. Many platforms publish a sitemap at that address. If you see a list of URLs, you are done with creation and can move on to submitting it. Our guide on finding the sitemap of a website covers the other common locations.
How do you write an XML sitemap by hand?
The sitemaps protocol requires three tags. The <urlset> tag wraps the whole file. Each page gets its own <url> tag. Inside that, a <loc> tag holds the page address. Everything else is optional.
- Open a plain text editor and save a file named sitemap.xml with UTF-8 encoding, which the protocol requires.
- Start with an XML declaration and the <urlset> opening tag that references the protocol namespace from sitemaps.org.
- Add one <url> block per page, with the full address in <loc>, for example https://example.com/pricing.
- Escape special characters. The protocol says all data values must be entity-escaped, so an ampersand in a URL becomes &.
- Close the <urlset> tag and upload the file to your site root.
Each <loc> value must be shorter than 2,048 characters, per the protocol.
How do you make a plain text sitemap?
A text sitemap is the simplest format. Google says it is a .txt file with one URL per line and nothing else in it. It suits a small site where you do not need image or video details. Save it as UTF-8, put it at the root, and submit it the same way as an XML file.
Which URLs belong in it?
Google tells site owners to use fully-qualified, absolute URLs and to list only canonical URLs, the version you want to appear in search results. That gives you a quick filter:
- Include pages that return a 200 status, are indexable, and are the canonical version.
- Leave out redirected URLs, pages with a noindex tag, 404 pages and duplicate variants. See what a canonical URL is if the term is new.
- Leave out thin utility pages such as cart steps or internal search results.
A sitemap full of redirects and blocked pages sends mixed signals, which makes it a poor file to trust.
What about lastmod, priority and changefreq?
Google says it uses the lastmod value only if it is consistently and verifiably accurate, and it should reflect meaningful changes, not a copyright year update. The protocol asks for the date the linked page was last modified, in YYYY-MM-DD form. Google ignores the priority and changefreq values, so you can skip them. If you cannot keep lastmod honest, omit it.
What are the size limits?
One sitemap file can hold at most 50,000 URLs and must be no larger than 50MB uncompressed. Beyond that, split the list into several sitemaps and tie them together with a sitemap index file, which the protocol also caps at 50,000 sitemaps.
Where do you put it and how do you submit it?
Put the file at the root, such as /sitemap.xml. Google notes that, unless submitted through Search Console, a sitemap only affects URLs under its own directory, so the root is the safe choice. Then submit it by following how to submit a sitemap to Google. You can also add a Sitemap line to your robots.txt, as shown in what a robots.txt file should look like.
Frequently Asked Questions
Can I create a sitemap for free?
Yes. A CMS plugin, a built-in feature or a hand-typed text file costs nothing. You only pay if you choose a hosted generator you do not need.
Does my sitemap have to be named sitemap.xml?
No, the name is a convention. Any name works as long as you submit the exact address and the file follows a supported format.
How often should I update it?
It should change whenever you add or remove a page. A generated sitemap does this on its own, which is the main reason to prefer one.
Should a new page wait for the sitemap?
No. A sitemap helps discovery but does not replace good internal links, so link new pages from existing ones as well.
What if my sitemap shows errors in Search Console?
Check that it is UTF-8, uses absolute URLs, stays under the limits and loads without a redirect. Fix the file, then resubmit it.