XML sitemap: create, submit and check it in Search Console

By SEOgrinder · Published · Updated · 9 min read

Short answer: An XML sitemap is a file that lists the addresses you want search engines to know: one <url> entry per page, with the address in <loc> and, if it is accurate, the date of the last change in <lastmod>. Build it from your CMS or your site's own data, stay within 50,000 addresses and 50 MB per file, name it in robots.txt and submit it in the Sitemaps report of Search Console. Submitting is a hint, not a promise: Google does not guarantee that it crawls or indexes what the file lists.

What does an XML sitemap contain?

This is the start of the sitemap of seogrinder.com as we fetched it on 4 November 2026 (curl -sS https://seogrinder.com/sitemap.xml | head -5):

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>https://seogrinder.com/</loc><lastmod>2026-11-04</lastmod></url>
  <url><loc>https://seogrinder.com/imprint</loc><lastmod>2026-11-02</lastmod></url>
  <url><loc>https://seogrinder.com/privacy</loc><lastmod>2026-11-02</lastmod></url>

The sitemaps.org protocol requires three things: an opening <urlset> tag with the namespace, a <url> entry for each page and a <loc> inside each entry. Every other tag is optional, and support for the optional ones "may vary among search engines". The file must be UTF-8, characters such as & must be escaped (&amp;), and all addresses in one file must belong to a single host.

In our own file we count 425 <loc> entries (curl -sS https://seogrinder.com/sitemap.xml | grep -o '<loc>' | wc -l, 5 November 2026): the start page, four legal pages, twelve blog overview pages and 408 articles. Each entry has only <loc> and <lastmod>: no <changefreq>, no <priority>, no hreflang annotation. The file is 45,765 bytes (curl -sS https://seogrinder.com/sitemap.xml | wc -c).

Do you need an XML sitemap?

Not always. Google's sitemap overview says that when your pages are properly linked, Google can usually discover most of your site. A sitemap helps most on a large site, on a new site with few external links, and on a site with a lot of video, images or news. You might not need one if your site is small (about 500 pages or fewer, counting only pages meant for search results) and every important page can be reached by links from the home page. Even so, Google adds, most sites benefit from one.

If you use WordPress, Wix or Blogger, Google says your CMS has likely made a sitemap available already. Open /sitemap.xml on your site before you build a second file.

A sitemap is no substitute for links. If a page you expect is missing from Google, a missing sitemap is only one of several causes: see why a website is not showing on Google. For a brand-new page, our article on ranking on Google fast shows where the sitemap fits.

How to create an XML sitemap

Start with the list of addresses, not the tool. Google says a sitemap names the URLs you prefer to show in results, the canonical ones: when the same content is reachable under several addresses, list your preferred one only. Our canonical tag guide explains how to pick it.

Then choose a way, as Google's page Build and submit a sitemap describes:

  • Let your CMS write it, if it can.
  • Write it by hand for fewer than a few dozen addresses. Google calls larger hand-made files tedious and hard to maintain.
  • Generate it from your own data for more. Google says the best way is to have your website software write the file. The order of the entries does not matter to Google.

Ours is generated: a script writes the blog entries from the article files and leaves the start page and legal pages alone.

What belongs in the file:

  • In: full addresses with https:// of pages that answer with status 200, can be indexed and should appear in search. Google asks for fully qualified addresses and crawls them exactly as listed.
  • Out: addresses that redirect (the Search Console help says to replace them with the addresses that should be crawled), pages that return errors and duplicates of a page you already list. In our view, pages with noindex stay out too: the sitemap invites Google in and the tag turns it away.

Put the file at the root, for example https://example.com/sitemap.xml. Google recommends the root; a sitemap in a subfolder affects only addresses below it, unless you submit it through Search Console.

How big can an XML sitemap be?

One file may hold at most 50,000 addresses and may be at most 50 MB uncompressed. You can compress it with gzip, but the uncompressed size counts (sitemaps.org). Above the limits, split the list and name the files in a sitemap index file, which may list up to 50,000 sitemaps and only sitemaps of its own site. Our file is far below both limits, so we need no index.

lastmod: set it only when the page really changed

<lastmod> is the one optional tag worth getting right. Google says it uses the value "if it's consistently and verifiably" accurate. A significant update means the main content, the structured data or the links; a new copyright year does not count. The protocol is blunter: the date must be "the date the linked page was last modified, not when the sitemap is generated".

So do not write today's date into every entry on every build. Google also ignores <priority> and <changefreq>, so leave both out.

In our file, 313 of 425 entries carry 2026-11-04, 108 carry 2026-11-05 and four carry 2026-11-02 (curl -sS https://seogrinder.com/sitemap.xml | grep -o '<lastmod>[^<]*' | sort | uniq -c, 5 November 2026). The article entries take the date from each article's updated line, so many entries share a date when articles are written or revised on the same day.

How do you submit an XML sitemap to Google?

There are three ways, and you can combine them:

  1. robots.txt. Add Sitemap: https://example.com/sitemap.xml with the full address. The line belongs to no user-agent group, so its position does not matter, and you can list several. Google finds it the next time it crawls your robots.txt. With an index file, you submit the index file. Ours is the last line of our robots.txt on 4 November 2026: Sitemap: https://seogrinder.com/sitemap.xml.
  2. The Sitemaps report in Search Console. Steps below.
  3. The Search Console API, to submit from code.

Submitting means telling Google where the file is. Google's Sitemaps report help says: "You cannot actually upload a sitemap to Google." The steps:

  1. Make sure you have owner permission for the property. Without it, name the sitemap in robots.txt instead.
  2. Publish the sitemap on your site.
  3. Run a live test of its address in URL Inspection and check that the page fetch is "Successful".
  4. Open the Sitemaps report, paste the address into "Add a new sitemap" and click "Submit".

Google says the file should be fetched immediately, but crawling the addresses in it can take time and not all of them will be crawled. In Google's words, "submitting a sitemap is merely a hint" (Google). The report shows a status per sitemap (Success, Couldn't fetch, Sitemap had X errors), when Google last read it and how many pages it discovered. Discovered is not indexed: Google says there is no guarantee that a discovered page has been or will be crawled or indexed. The report also lists only sitemaps submitted through it or the API, not those Google found through robots.txt.

This article follows Google's documentation. It shows no screenshot of Search Console and reports no result of a submission for our own file.

How to check an XML sitemap

  1. Fetch it. curl -sSI https://example.com/sitemap.xml should show status 200 and an XML content type. Ours showed HTTP/2 200 and content-type: application/xml; charset=utf-8 on 4 November 2026.
  2. Read the start. It begins with <urlset and the namespace, is UTF-8 and has no relative addresses.
  3. Request every address. The loop below does not follow redirects, so a redirect shows as 301 or 302.
  4. Check that Google can fetch it. Use the live test above. Google respects robots.txt when it fetches a sitemap, so a rule that blocks the file stops it.
  5. Read the Sitemaps report after submitting, and click a sitemap with errors for details.
for u in $(curl -sS https://seogrinder.com/sitemap.xml | grep -o 'https://seogrinder.com/[^<]*'); do
  curl -sS -o /dev/null -w '%{http_code}\n' "$u"
done | sort | uniq -c

On 5 November 2026, around 13:40 UTC, this printed 425 200: all 425 addresses answered 200.

SEOgrinder is our own free tool, and we build it. Scan a page and look at the task list ("Tasks") and at the item "Give agents a map" (tag "Sitemap") in the "AI readiness" tab. It reads the sitemap named in robots.txt, or /sitemap.xml if robots.txt names none, and can report:

FindingWhen it appears
No sitemap foundNeither robots.txt nor /sitemap.xml provided one
Sitemap not declared in robots.txtA sitemap exists, but robots.txt does not name it
Sitemap entries without a lastmod dateFewer than half of the entries carry a date
"3 of 15 sitemap URLs not answering 200" (example numbers)A sample had errors or redirects
Sitemap lists a page that carries noindexFound by the site crawl

It tests a sample of up to 15 addresses spread over the list, not every address, which is why the loop above is worth running. It also reads at most 3 MB per file and ten sitemaps of an index, and marks a larger one as not read in full.

Common mistakes

  • Addresses that redirect, fail or carry noindex. Search Console reports unreachable ones; replace a redirect by its target.
  • Every variant of a page. Listing http and https, www and non-www, or parameter versions: list the canonical one.
  • Today's date as lastmod on every build. Google uses the date when it is consistently and verifiably accurate.
  • Addresses the file may not contain. The report calls this "URL not allowed": another domain, another protocol or a folder above the sitemap's own.
  • Reading "submitted" as "indexed". A submitted sitemap guarantees nothing.
  • Leaving a failing file alone. Google retries a failed fetch for a few days, then stops. Fix the cause and submit again.

FAQ

Do I have to submit it if robots.txt already names it?

No. Google finds a sitemap named in robots.txt on its next crawl of that file. Submitting adds the report: you see when Googlebot accessed the file and which errors it met.

Does an XML sitemap improve my rankings?

Google describes its purpose as discovery: it helps search engines find addresses and can improve the crawling of larger or more complex sites. The pages we cite promise nothing about positions, and nobody can.

Your next step

Run the loop above on your own sitemap and fix every address that does not answer 200. Then scan your site with SEOgrinder, open the task list and start with the sitemap findings. After your changes press Check again, and if you have not done it yet, submit the file in the Sitemaps report of Search Console.

More from the blog