Robots.txt is a plain text file placed at the root of a website, such as example.com/robots.txt, that tells search engine crawlers and other bots which parts of the site they may or may not crawl.
It follows the Robots Exclusion Protocol, which Google and other major search engines respect. Malicious bots often ignore it, so it is not a security tool.
Basic syntax
A robots.txt file is made of groups of rules:
- User-agent: which crawler the rules apply to, such as Googlebot, or * for all.
- Disallow: a path the crawler should not crawl, such as /wp-admin/.
- Allow: an exception inside a disallowed path.
- Sitemap: the full URL of your XML sitemap.
A typical WordPress file blocks /wp-admin/ but allows /wp-admin/admin-ajax.php, and lists the sitemap.
Robots.txt does not stop indexing
Blocking a URL stops crawling, not indexing. Google can still index a blocked URL if other pages link to it, showing it with no description. To keep a page out of search results, use a Noindex Tag tag and leave the page crawlable so Google can see the tag.
AI crawlers
Robots.txt is also how you control AI bots. GPTBot (OpenAI training), OAI-SearchBot (ChatGPT search), ClaudeBot, PerplexityBot and Google-Extended (Gemini training) each have their own user-agent. Blocking search-related AI bots can remove your site from AI answers, so decide bot by bot rather than blocking all of them. See AI Crawler.
Common mistakes
- “Disallow: /” left on after launching a site, which blocks everything.
- Blocking CSS or JavaScript files Google needs to render pages.
- Using robots.txt to hide private content, which only advertises where it is.
- Case and trailing slash mistakes in paths.
Test your file with the robots.txt report in Google Search Console. Our technical SEO audits review it on every project.
FAQ
Do I need a robots.txt file?
It is not required. Without one, crawlers assume they may crawl everything. Most sites still use one to list the sitemap and block admin areas.
Does Google support crawl-delay?
No. Google ignores crawl-delay. Bing and some other crawlers support it.
Guides that cover Robots.txt
- How to Get Your Website on Google: Steps, Timelines and FixesGetting your website on Google is free. Make sure the site is crawlable, verify it in Search Console,...
- llms.txt for Business Websites: What It Does and Whether You Need Onellms.txt is an optional Markdown file that summarizes a website for AI tools. Google says Search ignores it....
- Answer Engine Optimization: A Practical Checklist for Local BusinessesAnswer engine optimization means making your content easy to quote. Google says AI Overviews need only an indexed,...
