How to Create and Submit an XML Sitemap, Step by Step
What belongs in a sitemap, what the generator outputs (and what it leaves for you to fix), and how to submit it in Google Search Console.
An XML sitemap is a plain list of the URLs you want search engines to know about. For a small site it takes a few minutes to make, but a careless one can list pages you do not want indexed, carry dates that mean nothing, or break because of one stray character. This guide walks through the full process, shows exactly what the sitemap generator on this site outputs, and lists the checks you still have to do yourself.
What a sitemap does and does not do
A sitemap helps search engines discover your pages and learn when they changed. It is a hint, not an instruction. Google's documentation says submitting a sitemap does not guarantee that it will download the file or crawl every URL in it. Pages are still indexed only if they are crawlable, useful and not duplicates of something else.
A sitemap matters most when your site is new (few other sites link to it), large, or has pages that are hard to reach by clicking through links. A five-page site with clear navigation will be found either way, but the file costs nothing and is a good habit.
Step 1: Decide which URLs belong in it
List only pages that you want to appear in search results and that return a normal, successful page. A useful test for each URL: open it, and ask whether it is the final address, not a redirect, and whether it is the version you want people to find.
- Include: home page, category pages, product or article pages, key landing pages.
- Leave out: URLs that redirect, pages that return an error, pages marked
noindex, internal search results, cart and login pages, and parameter variations of the same page (sorting, tracking tags). - One address per page: if a page works both with and without a trailing slash, or on both
httpandhttps, pick the one you treat as the main version and list only that.
Listing a noindex page sends mixed signals: the sitemap says "index this" while the page says "do not". If you are unsure how to mark a page noindex, the meta tag generator outputs the robots tag; change its default index, follow to noindex.
Step 2: Write the URL list
Put one full URL per line in a text file or spreadsheet column. "Full" means it starts with https:// and includes the domain. The sitemaps.org protocol says each address must include the protocol, so shop.example.in/about is not valid but https://shop.example.in/about is. Keep to one hostname per sitemap.
If your list came from several sources (a CMS export, an old sitemap, a crawl), it probably has repeats. The remove duplicate lines tool keeps the first copy of each line and drops later exact repeats. It compares lines exactly, so two lines that differ by a space or letter case are treated as different, and blank lines are kept. Tidy those by hand.
Step 3: Generate the file and read the output
Paste the list into the generator. Here is a small worked example. The input was:
https://shop.example.in/https://shop.example.in/category/shoes- (a blank line)
https://shop.example.in/category/shoes(repeated)https://shop.example.in/search?q=kurta&size=mhttps://shop.example.in/about(with spaces around it)
The tool ignores the blank line, trims the spaces, and wraps every remaining line in the same pattern, giving five entries:
| Input line | What the tool does |
|---|---|
| Blank line | Skipped |
| Leading or trailing spaces | Trimmed |
| Repeated URL | Written twice (no deduplication) |
URL containing & | Written as typed, not escaped |
| Every entry | Gets <lastmod> set to the day you generate it |
Each entry looks like this, inside a urlset element that declares the sitemaps.org namespace:
<url><loc>https://shop.example.in/category/shoes</loc><lastmod>2026-11-20</lastmod></url>
Two things in that output need your attention before you upload it.
Step 4: Fix the two things the generator will not
Escape special characters
The sitemaps.org protocol requires values to be entity-escaped, and the file must be UTF-8. In the example, the search URL contains &, which in XML must be written as &. The generator leaves it as typed, so an unescaped ampersand would make the file invalid XML and a parser may reject it. After generating, search the output for & and replace each with &. Better still, avoid listing parameter URLs at all (see Step 1); then the problem rarely arises.
Make the lastmod dates honest
The generator stamps every URL with today's date. That is fine for a brand-new site where everything really was published today. On an established site it is wrong: your 2023 policy page did not change today. Search engines can only make use of a modification date if it is reliable, and a date that changes on every URL every time you regenerate teaches them to ignore it. For an older site, either replace the dates with the real last-edit dates, or delete the <lastmod> tags. The date is optional, and no date is better than a false one.
If you paste nothing, the tool does not produce a placeholder URL; it outputs an empty sitemap shell. Always check that the entries are the ones you expect.
Step 5: Upload, reference and submit
- Save it as
sitemap.xmland upload it to the root of your site, so it opens athttps://your-domain/sitemap.xml. A sitemap can only safely list URLs at or below its own location, so the root is the simplest place. - Point to it from robots.txt. The robots.txt generator adds a
Sitemap:line pointing tohttps://your-domain/sitemap.xml. Check that this matches where you actually put the file. - Submit it in Google Search Console. Open your property, go to the Sitemaps report, enter the sitemap's address and submit. Google also accepts a
Sitemap:line in robots.txt as a way to find the file. - Check the report after a while. It shows whether the file was read and flags errors such as invalid XML or unreachable URLs.
Keep in mind that the robots.txt generator's default output also includes a fixed Disallow: /admin/ rule. Replace it with paths that exist on your site. Do not block a page in robots.txt and also list it in the sitemap; the two files should agree.
A quick decision framework: when to regenerate
- Static site, rarely changes: regenerate when you add or remove pages, and keep real dates.
- Blog or shop that changes weekly: a hand-pasted list becomes tedious. Use your CMS or platform's own sitemap feature, and use this generator for one-off sites, audits or new launches.
- You deleted or redirected pages: remove them from the list. A sitemap full of dead URLs reduces how much you can trust the Search Console report.
Limits: what this does not cover
- Size. A single sitemap can hold up to 50,000 URLs or 50 MB uncompressed. Bigger sites must split into several sitemaps and list them in a sitemap index file. The generator does not build an index file and does not stop you at 50,000 lines, so count your list first.
- No crawling. The tool does not visit your site. It formats whatever you paste, so it will not find missing pages or detect broken links.
- No validation. It does not check that URLs are live, canonical, on one hostname, or that characters are escaped.
- Other fields and types. It outputs only
locandlastmod. It does not produce image, video or news sitemaps. - No guarantee of indexing. Even a perfect sitemap only helps discovery.
Checklist before you submit
- Every URL is absolute, starts with
https://, and uses one hostname. - Every URL opens directly (no redirect, no error) and is meant to be indexed.
- No duplicates, no noindex pages, no parameter or search URLs.
- Every
&is written as&. - Dates are true last-edit dates, or removed.
- The file sits at the site root and robots.txt points to it.
- The count is under 50,000 URLs and 50 MB.
Work through that list once and your sitemap will do its small job properly: tell search engines which pages exist and when they last changed.
Tools used in this article
- Sitemap Generator — Paste a list of your page URLs and get back a valid XML sitemap, ready to upload and submit to Search Console.
- robots.txt Generator — Enter your domain to generate a starter robots.txt with a sitemap reference — a fixed, standard rule set you can customize further by hand.
- Remove Duplicate Lines — Remove repeated lines from a list, keeping only the first occurrence of each unique line, in original order.
- Meta Tag Generator — Enter your page title, description, keywords, and URL to generate a bundle of core meta tags (description, keywords, Open Graph title/description, robots) in one go.