Free tool

Robots.txt generator

A robots.txt file tells crawlers which parts of your site they may fetch. Pick a preset (allow all, block all, block AI crawlers, search engines only), add the paths to keep private and your sitemap, then copy or download the file and put it at /robots.txt. The tester below it shows whether any URL is allowed for Googlebot, GPTBot or any other crawler, and which line decides it, following the rules of RFC 9309.

Free · no sign-up · runs in your browser, nothing is uploaded

Rules

Start from a preset

All crawlers (User-agent: *)
Block these bots completely
robots.txt
1User-agent: *
2Allow: /
Test a URL
ALLOWED /admin/settings for Googlebot. Allowed by "Allow: /" on line 2, the longest matching rule.Group used: User-agent * (line 1).
Same URL for every known bot (click one to test it)

robots.txt syntax

A file is a list of groups. Each group starts with one or more User-agent lines and is followed by its rules. Field names are case-insensitive; paths are case-sensitive, so /Admin and /admin are different rules.

LineMeaning
User-agent: *Starts a group for every crawler that has no group of its own
User-agent: GPTBotStarts a group for one crawler (its product token, matched without case)
Disallow: /admin/Do not fetch URLs whose path starts with /admin/
Allow: /admin/helpException: may fetch this path even though a shorter Disallow matches
Disallow: /*.pdf$* matches any characters, $ anchors the end: every URL ending in .pdf
Disallow:Empty value: nothing is blocked
Sitemap: https://…/sitemap.xmlFull URL of a sitemap; not tied to any group, may appear many times
Crawl-delay: 10Seconds between requests; not in RFC 9309, ignored by Google
# commentIgnored to the end of the line

The ? and the query string count as part of the path, so Disallow: /*?sort= blocks sorted listing pages. Google reads up to 500 KiB of the file and ignores the rest.

How a crawler decides which rule wins

RFC 9309 and Google follow the same three steps, and the tester above does the same:

  1. Pick the group. The crawler looks for a group whose User-agent matches its product token, ignoring case. If it finds one, it uses only that group and ignores User-agent: * completely. Several groups for the same token are merged. With no match, it uses the * group. One exception: Google lists two tokens for some crawlers, so Googlebot-Image with no group of its own follows the Googlebot group before *. Other related names do not: Google says Storebot-Google without its own group uses *, even when a Googlebot group exists.
  2. Find the longest match. Of all Allow and Disallow rules that match the path, the one with the longest path wins, whatever its order in the file.
  3. Break ties with Allow. If an Allow and a Disallow match with the same length, the Allow wins. If nothing matches, the URL is allowed. /robots.txt itself is always allowed.
User-agent: *
Disallow: /admin/
Allow: /admin/public/

User-agent: Googlebot
Disallow: /tmp/

# /admin/public/logo.png for Bingbot   -> allowed (Allow: /admin/public/ is longer)
# /admin/settings        for Bingbot   -> blocked (Disallow: /admin/)
# /admin/settings        for Googlebot -> allowed (Googlebot has its own group, which has no /admin/ rule)

The last line is the most common mistake: once a crawler has its own group, rules under * no longer apply to it. Copy the shared rules into every named group that needs them.

Blocking AI crawlers

AI companies use separate user agents for separate jobs, so you can opt out of model training and still appear in AI search answers. These tokens come from each operator's own documentation:

User-agentOperatorUsed for
GPTBotOpenAIModel training
ClaudeBotAnthropicModel training
Google-ExtendedGoogleModel training: Gemini training and grounding; not Google Search
Applebot-ExtendedAppleModel training: Apple model training; Applebot still crawls for search
meta-externalagentMetaModel training
CCBotCommon CrawlModel training
AmazonbotAmazonModel training: Amazon services; Amazon says it may be used to train its AI models
OAI-SearchBotOpenAIAI search: ChatGPT search results
Claude-SearchBotAnthropicAI search
PerplexityBotPerplexityAI search
ChatGPT-UserOpenAIFetch on user request: user-initiated; OpenAI says robots.txt may not apply
Claude-UserAnthropicFetch on user request
Perplexity-UserPerplexityFetch on user request: user-initiated; Perplexity says it generally ignores robots.txt
  • Google-Extended and Applebot-Extended are control tokens, not separate crawlers. Google says Google-Extended does not affect inclusion or ranking in Google Search. Blocking Googlebot or Applebot would remove you from those search engines.
  • User-triggered fetchers such as ChatGPT-User and Perplexity-User fetch a page because a person asked for it. OpenAI says robots.txt rules may not apply to them, and Perplexity says its fetcher generally ignores robots.txt.
  • SEO tool crawlers such as AhrefsBot, SemrushBot, MJ12bot and DotBot collect link and keyword data for those products. Blocking them saves bandwidth and does not change how Google ranks you; they are listed in the generator above.
  • robots.txt is a request, not a lock. Well-behaved crawlers follow it. To stop a crawler that does not, block it at your server, CDN or firewall.

robots.txt in Next.js, WordPress and static sites

On a static site or most servers, save the file as robots.txt in the public web root. In the Next.js App Router, either put a static file at app/robots.txt, or generate it with app/robots.ts:

// app/robots.ts
import type { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
  return {
    rules: [
      { userAgent: '*', allow: '/', disallow: ['/admin/', '/api/'] },
      { userAgent: ['GPTBot', 'ClaudeBot', 'Google-Extended'], disallow: '/' },
    ],
    sitemap: 'https://example.com/sitemap.xml',
  };
}

WordPress serves a virtual robots.txt when no real file exists. SEO plugins let you edit it, or you can upload a real robots.txt to the site root, which takes priority. The WordPress preset above keeps /wp-admin/ closed but allows admin-ajax.php, which themes and plugins call from public pages.

Mistakes that cost traffic

  • Shipping a staging file to production. A leftover Disallow: / blocks the whole site. Test the home page URL after every deploy.
  • Blocking pages you want removed. A crawler that cannot fetch a page never sees its noindex tag. Allow it, add noindex, and wait for it to drop out.
  • Blocking CSS and JavaScript. Google renders pages; if it cannot load your scripts and styles, it may misread the page.
  • Hiding secrets. robots.txt is public, and listing /secret-admin/ tells everyone where it is. Protect private pages with a login.
  • Expecting instant changes. RFC 9309 lets crawlers cache the file for up to 24 hours, and Google generally does.
  • Server errors. If robots.txt returns a 5xx error, RFC 9309 tells crawlers to assume everything is disallowed. A 404 means everything is allowed.

Related free tools: the meta tag generator for noindex and social previews, the URL parser to split paths and query strings, the URL decoder for percent-encoded paths and the XML formatter to check a sitemap. For full SEO products, see SEO tools on DevHunt.

FAQ

What is a robots.txt file?+

A plain text file at the root of a site (example.com/robots.txt) that tells crawlers which URLs they may fetch. It lists groups of rules per crawler (User-agent) with Disallow and Allow paths, plus optional Sitemap lines. The format is standardized in RFC 9309, the Robots Exclusion Protocol.

Where do I put robots.txt?+

At the top level of the host, so it loads at https://yourdomain.com/robots.txt. Crawlers do not look for it in subfolders. Each subdomain, protocol and port has its own file: blog.example.com needs its own robots.txt.

How do I block AI crawlers like GPTBot and ClaudeBot?+

Add a group for each crawler with "Disallow: /". For example, "User-agent: GPTBot" then "Disallow: /" blocks OpenAI's training crawler. Use the "Block AI training" preset above for training crawlers only, or "Block all AI bots" to also block AI search and user-triggered fetchers. Blocking Google-Extended does not affect Google Search.

Does robots.txt stop a page from appearing in Google?+

No. robots.txt controls crawling, not indexing. Google can still index a blocked URL, without its content, if other pages link to it. To keep a page out of results, allow crawling and add a noindex robots meta tag or X-Robots-Tag header.

Do I need a robots.txt file?+

No. Without one, crawlers assume everything is allowed; Google treats a 404 for robots.txt that way. Add one when you want to keep crawlers out of some paths, block specific bots, or list your sitemaps.

Does Google support Crawl-delay?+

No. Google ignores the Crawl-delay line. Bing reads it, and Anthropic says its crawlers support it. Google adjusts its crawl rate on its own, and slows down when a server returns 500, 503 or 429 errors.

What does "Disallow: /" mean?+

It blocks the whole site for the crawlers in that group, because every path starts with /. An empty "Disallow:" with no path means the opposite: nothing is blocked.

How do I test my robots.txt?+

Switch the tool above to "Test my robots.txt", paste your file and type a URL. It shows allowed or blocked, the line that decided it and the group that was used, for any crawler. You can type a bot name like GPTBot or paste a full User-Agent header from your server logs. Google Search Console also has a robots.txt report that shows the version Google last fetched.

Sources: RFC 9309: Robots Exclusion Protocol · Google: how Google interprets robots.txt · Google: create a robots.txt file · Google's common crawlers (Google-Extended) · OpenAI crawlers · Anthropic crawlers · Perplexity crawlers · About Applebot · Meta web crawlers · Common Crawl CCBot · Amazonbot · AhrefsBot · SemrushBot · Majestic MJ12bot · Moz DotBot · Next.js: robots.ts. Checked 2026-10-31.