Robots.txt Generator

Generate robots.txt files to control how search engines crawl your website. Add allow, disallow, and crawl-delay rules.

Embed this tool

Rule

robots.txt

User-agent: *
Disallow: /admin/

Advertisement

Ad

Understanding robots.txt

The robots.txt file is the first stop for any well-behaved web crawler. When a search engine bot visits your site, it requests /robots.txt to learn which URLs it is allowed to fetch. The file uses a simple key-value syntax: each rule block begins with a User-agent line that specifies which crawler the block applies to, followed by Allow and Disallow directives that match URL paths.

It is important to understand that robots.txt is a crawling directive, not an access-control mechanism. Sensitive content should never be protected solely by robots.txt, because malicious bots often ignore it entirely. For true security, use authentication, IP whitelisting, or proper access controls. If you want to keep a page out of search results while still allowing crawlers to read it, use a noindex meta tag instead.

For larger websites, combining robots.txt with an XML sitemap is a best practice. The sitemap directive in robots.txt helps search engines discover your sitemap quickly, ensuring that new and updated pages are indexed faster. If you need help creating a sitemap or validating your markup, try our HTML Formatter or JSON Formatter.

Google's September 2019 move to formalize the Robots Exclusion Protocol through the IETF brought welcome clarity to long-standing ambiguities. The draft specification clarified how to handle HTTP status codes, redirects, and caching, making robots.txt parsing more consistent across different crawler implementations.

References & Further Reading

Frequently Asked Questions

A robots.txt file is a plain-text file placed in the root directory of a website that communicates with web crawlers and other automated agents. It uses the Robots Exclusion Protocol (REP) to specify which parts of a site should not be crawled. While robots.txt can prevent crawling, it does not prevent indexing if content is discovered through other means, nor does it provide any security or access control.

Related Tools