Robots.txt and sitemaps: what search engines actually read
What robots.txt and sitemaps really do, the rules search engines follow, why neither keeps a page out of results, and the mistakes that cause the most trouble.
Published
On this page
The short answer: robots.txt tells search engine crawlers which parts of your site they may fetch, and a sitemap lists the pages you would like them to find. Neither is a security control, and neither removes a page from search results. To keep a page out of results, let crawlers fetch it and add a noindex tag. To keep something private, put it behind a password.
These two small files cause a surprising amount of confusion, and a single wrong line in robots.txt can hide a whole site from search engines. This guide explains what crawlers actually read, the rules they follow, and the mistakes that cause the most trouble.
Three different jobs
It helps to separate three tools that are often mixed up. Each answers a different question.

Google is direct about the first point. Its introduction to robots.txt says it is not a mechanism for keeping a web page out of Google. A page blocked in robots.txt can still appear in results, usually without a description, if other sites link to it.
How robots.txt works
The file must sit at the root of the site, for example https://www.example.com/robots.txt. A copy in a subfolder is ignored. It applies only to the exact host, protocol and port it was fetched from, so example.com and www.example.com each need their own if both serve pages.
It is made of groups. Each group names one or more crawlers with User-agent, then lists Allow and Disallow rules. A simple, sensible file looks like this:
User-agent: *
Disallow: /admin/
Disallow: /search
Allow: /admin/help/
Sitemap: https://www.example.com/sitemap.xml
The rules that trip people up, all from Google's robots.txt specification:
- Paths are case-sensitive.
Disallow: /Admin/does not block/admin/. - The most specific rule wins. When an
Allowand aDisallowboth match, the one with the longer path applies. If they are equally long, the less restrictive one wins. - A crawler follows only its own group. If there is a group for
Googlebot, Google ignores the*group entirely, so repeat any shared rules. - Size is limited. Google reads only the first 500 KiB of the file.
- Changes aren't instant. Google usually caches the file for up to 24 hours.
What happens when the file is missing or broken
The response code for robots.txt itself matters more than many people realise. If the server returns a 404 or another 4xx error, Google treats the site as having no restrictions. If it returns a 5xx server error, Google stops crawling the site for 12 hours, then falls back to the last good copy it saw for up to 30 days. A server that wrongly answers 500 for robots.txt can therefore slow down crawling of the whole site.
Try it now
Robots.txt Checker
Check a website's robots.txt: what each crawler may crawl, mistakes and sitemap lines, and test whether a path is allowed for Googlebot.
The robots.txt mistakes that matter
A leftover block from development
Staging sites often use this to stay out of search engines:
User-agent: *
Disallow: /
If it is copied to the live site at launch, nothing gets crawled. This is the single most damaging robots.txt mistake, and it is easy to miss because the site still works perfectly for visitors.
Blocking CSS and scripts
Search engines render pages much as a browser does. If robots.txt blocks the folders holding your stylesheets or scripts, they may see a broken page and misjudge its content. Leave theme and asset folders open.
Blocking a page you want removed
If a page already in search results is blocked in robots.txt, the crawler can't fetch it to see a noindex tag, so the old listing may stay. Remove the block, add noindex, and wait for the page to drop out.
How sitemaps work
A sitemap is an XML file listing the pages you want search engines to know about. It is most useful for large sites, new sites with few incoming links, and pages that are hard to reach through normal navigation. A minimal one looks like this:
<?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>
</urlset>
Google's sitemap guidance sets the practical rules:
- Use full addresses. Every
locmust be an absolute URL, includinghttps://and the host. - Stay within the limits. One sitemap can hold up to 50,000 URLs or 50 MB uncompressed. Larger sites split the list and use a sitemap index file that points to each part.
- Only list real pages. Include the final, canonical address of each page. Leave out redirects, error pages and pages marked
noindex. - Keep lastmod honest. Google uses
lastmodif it is consistently accurate. It ignorespriorityandchangefreq.
Tell search engines where the sitemap is in two ways: add a Sitemap: line with its full address to robots.txt, and submit it in Google Search Console and Bing Webmaster Tools. A sitemap is a hint, not an order. Listing a page doesn't guarantee it will be crawled or shown.
Checking your sitemap
The Sitemap Checker starts where a crawler would. It reads the Sitemap: lines in your robots.txt, then tries the usual addresses, /sitemap.xml and /sitemap_index.xml. It reads up to 50,000 entries, handles compressed .gz files, lists the child sitemaps of an index file, and flags entries that point to a different host.
Common problems it finds:
- No sitemap at any of the usual addresses, and no
Sitemap:line inrobots.txt. - Entries using
http://or the wrongwwwversion, which then redirect. - Entries for a different domain, often left over from a site move or a staging copy.
- A file that isn't valid XML, usually because a plugin printed an error message at the top.
Try it now
Sitemap Checker
Find a website's XML sitemap and check it: URL count, dates, duplicates, other-host addresses and the 50,000 limit, including indexes and .gz.
Common questions
Do I need a robots.txt file at all?
No. If there is no file and the server returns a 404, crawlers assume they may fetch everything. A short file is still useful to point to your sitemap and keep crawlers out of search results pages and admin areas.
Does robots.txt stop AI crawlers?
Only the ones that choose to follow it. Many AI companies publish crawler names you can block in robots.txt, and the large ones say they respect it. Badly behaved bots ignore it, and blocking those needs server or firewall rules.
Can I use noindex in robots.txt?
No. Google's robots.txt parser ignores every rule except user-agent, allow and disallow (plus the sitemap line), so a noindex line there does nothing. Use a meta name="robots" tag in the page or an X-Robots-Tag response header.
How often should my sitemap update?
Whenever pages are added, removed or changed. Most content systems and SEO plugins generate the sitemap automatically. Check it after installing or changing such a plugin.
Why are pages in my sitemap not in search results?
A sitemap only suggests pages. Search engines still decide what to crawl and show, based on quality, duplicates and links. Check the page isn't blocked in robots.txt, isn't marked noindex and returns a 200.
Related tools
-
Robots.txt Checker
Check a website's robots.txt: what each crawler may crawl, mistakes and sitemap lines, and test whether a path is allowed for Googlebot.
-
Sitemap Checker
Find a website's XML sitemap and check it: URL count, dates, duplicates, other-host addresses and the 50,000 limit, including indexes and .gz.
More website guides
-
Website
security.txt explained: how to publish one
What a security.txt file is for, the Contact and Expires fields it needs, where to put it on your website and the mistakes that make researchers ignore it.
-
Website
Redirect chains and loops: fixing http-to-https and www redirects
How redirects work, why chains slow your site and loops break it, and how to send every version of your address to one final address in a single step.
-
Website
Why is my SSL certificate not trusted?
The five common reasons browsers reject a certificate, from a missing intermediate to a wrong clock, and how to fix each one.