To create a sitemap.xml for a static website, make a UTF-8 text file named sitemap.xml that lists the full address of every page you want search engines to find, upload it to the root folder of your site, and tell search engines where it is with a line in robots.txt and through Google Search Console and Bing Webmaster Tools. You can write it by hand for a small site or have a tool generate it from your site folder.
This guide covers what a sitemap is, what to put in it, the format, how to create one step by step and how to submit it.
What a sitemap.xml does
A sitemap is a list of the pages on your site, written in a standard XML format that search engines understand. It helps them discover pages, especially new pages or ones that few other pages link to. It is a hint, not a command: listing a page does not guarantee it will be crawled or appear in search results.
A sitemap is different from a "site map" page for visitors. The XML file is for search engines. You can have both.
What to include and what to leave out
Include the pages you would be happy to see in search results:
- Your home page and main section pages.
- Every content page, such as services, articles, products and contact.
- Only the preferred (canonical) address of each page. If a page can be reached as both
/about.htmland/about/, list only the one you use.
Leave out:
- Pages that redirect elsewhere or return an error.
- Pages blocked in robots.txt or marked
noindex. - Thank-you pages, test pages, drafts and duplicate copies.
- Images, CSS and JavaScript files (images can be listed with a separate extension, but most small sites do not need it).
The sitemap format
A basic sitemap has an opening line, a urlset wrapper and one url entry per page. Each line below is one line of the file:
<?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-10-01</lastmod></url><url><loc>https://www.example.com/about.html</loc></url></urlset>
The rules that matter most:
- Use full, absolute addresses, including
https://and your domain. Relative paths such asabout.htmlare not valid in a sitemap. - Save the file as UTF-8.
- Escape special characters in addresses. An ampersand must be written as
&. - Use the exact address visitors see, with the same
wwwor non-wwwand the samehttpsas your live site.
The optional tags
| Tag | Meaning | Worth adding? |
|---|---|---|
loc | The page address | Required |
lastmod | When the page last changed meaningfully | Yes, if you keep it accurate |
changefreq | How often the page changes | Optional; Google says it ignores it |
priority | Importance relative to your other pages | Optional; Google says it ignores it |
Google uses lastmod only when it is consistently accurate, so update it when the main content of a page changes, not for small edits like a new copyright year. If you cannot keep it accurate, leave it out.
Size limits
One sitemap file can list up to 50,000 addresses and be up to 50MB uncompressed. Static sites rarely come close. If yours does, split it into several sitemaps and list them in a sitemap index file.
How to create one, step by step
- List your pages. Go through your site folder and note every HTML page you want indexed. Skip the ones from the "leave out" list above.
- Turn file paths into addresses. A file at
services/design.htmlon a site athttps://www.example.combecomeshttps://www.example.com/services/design.html. Your home pageindex.htmlis usually listed as justhttps://www.example.com/. - Write the file. Open a plain text or code editor, add the opening lines shown above, one
urlentry per page, and the closing</urlset>tag. Save it assitemap.xmlwith UTF-8 encoding. - Check it. Open the file in a browser. If the XML is broken, most browsers show an error. Fix any typos, unescaped ampersands or missing closing tags.
- Upload it to the root folder of your site, the same folder as your home page, so it is available at
https://www.example.com/sitemap.xml. - Add it to robots.txt. In the
robots.txtfile in your root folder, add a line such asSitemap: https://www.example.com/sitemap.xml. Search engines that read robots.txt will find it there.
Remember to update the sitemap whenever you add, rename or remove pages. A sitemap that lists missing pages is not harmful, but it is less useful and shows up as errors in search tools.
Telling Google and Bing about your sitemap
Google has retired its old sitemap "ping" address, so sending a ping URL no longer does anything there. Use these methods instead:
- Google: add and verify your site in Google Search Console, open Sitemaps, enter the sitemap address and submit it. The report shows when Google last read the file and any errors it found.
- Bing: add your site to Bing Webmaster Tools and submit the sitemap address in its Sitemaps section.
- Everyone else: the
Sitemap:line in robots.txt lets other search engines find the file without you submitting it anywhere.
You only need to submit once. After that, search engines check the sitemap again on their own schedule, so keeping the file up to date is enough.
The easier way: generate your sitemap in Apollo Editor
Apollo Editor is a Windows desktop HTML editor with sitemap creation built into its Site Explorer. Because it already knows every page in your site folder, it saves you from listing pages and typing addresses by hand.
- Sitemap creation from the pages in your site.
- Site structure view and a visual navigation tree, so you can see which pages exist and how they connect.
- Broken link detection, to catch missing pages before they end up in your sitemap.
- Publishing over FTP, FTPS or SFTP that identifies changed files, so an updated sitemap goes up with the pages that changed.
Your site stays as ordinary HTML files in a folder, so the sitemap is just another file you can open and check. For related tasks, see how to write a title and meta description, how to find broken links on your website and how to upload your website.
Frequently asked questions
Does a small website need a sitemap?
Small, well-linked sites can be crawled without one, but a sitemap is easy to add and helps search engines find every page.
Where should sitemap.xml go?
Usually in the root folder of the site, for example example.com/sitemap.xml, and listed in robots.txt.
How do I submit a sitemap to Google?
Add the site to Google Search Console, open Sitemaps and enter the sitemap address.
