What is robots.txt?
The robots.txt file is a plain text file placed in your website's root directory that tells search engine crawlers which pages or sections they are allowed or not allowed to access. It follows the Robots Exclusion Protocol and is the first file crawlers look for when visiting your site. A well-configured robots.txt helps you manage crawl budget, keep private areas out of search results, and point crawlers to your sitemap.
Common directives
User-agent specifies which crawler the rules apply to (use * for all). Disallow blocks a path, while Allow overrides a disallow for a more specific path. Sitemap tells crawlers where to find your XML sitemap, and Crawl-delay (honoured by some bots) sets a pause between requests to reduce server load.
Important notes
Robots.txt is advisory β well-behaved crawlers respect it, but malicious bots may ignore it. Never rely on robots.txt for security; use authentication or server-level access controls instead. Upload the generated file to your domain root (e.g. https://example.com/robots.txt). This tool runs entirely in your browser.
Worked example: sample robots.txt
User-agent: *
Disallow: /admin/
Disallow: /cart/
Allow: /cart/thank-you
Crawl-delay: 2
User-agent: Googlebot
Disallow: /staging/
Sitemap: https://shop.example.com/sitemap.xml
What each line does:
User-agent: *applies the following rules to all crawlers that follow robots.txt.Disallow: /admin/asks bots not to crawl URLs under/admin/.Disallow: /cart/blocks crawling of checkout paths.Allow: /cart/thank-youoverrides the disallow for that one thank-you page (more specific path wins).Crawl-delay: 2suggests a 2-second pause between requests (only some bots honor this).User-agent: Googlebotstarts a separate rule block for Googleβs crawler.Sitemap:points crawlers to your XML sitemap so they can discover URLs efficiently.
Blocking crawling vs blocking indexing: Disallow in robots.txt limits crawling (fetching URLs). A URL can still appear in search results if other sites link to it. To stop indexing (showing in results), use noindex in page meta tags or HTTP headers, or return authentication on sensitive pages. Robots.txt alone does not remove pages from the index.