Skip to content

Generated robots.txt

5 lines · 94 chars
User-agent: *
Disallow: /admin/
Disallow: /private/

Sitemap: https://example.com/sitemap.xml

Upload as robots.txt to the root of your domain (https://yoursite.com/robots.txt). It only controls crawling; to keep a page out of Google, use a noindex tag instead.

This tool checks one thing. Our audit checks 190+.

DarnItSEO Audit scans your entire site and writes the fix instructions for every issue it finds. Included in every yearly plan.

Building the file from choices instead of typing it

Most robots.txt problems are typing problems: a forgotten slash, a Disallow copied from staging, a sitemap URL that still points at the dev domain. This generator removes that class of bug. You pick a preset or add groups, choose a crawler for each group, list the paths to allow or block, and the tool writes clean syntax in your browser as you go. Nothing is sent to a server, and you can copy the result or download it as a robots.txt file.

Five presets cover the common starting points: allow everything, block admin areas, a WordPress set (blocks /wp-admin/ but keeps admin-ajax.php open, plus internal search), block AI training bots, and block everything for a staging site. The crawler picker lists the user agents worth knowing, from Googlebot and Bingbot to GPTBot, OAI-SearchBot, ClaudeBot, PerplexityBot, CCBot and Bytespider.

The tool also warns as you build. It tells you when a path was missing its leading slash and was fixed, when the same crawler appears in two groups, when Crawl-delay is set (Google ignores it), when the sitemap is not a full URL, and, loudly, when User-agent: * is paired with Disallow: /.

The smallest file that does the job

For most marketing sites the right robots.txt is tiny: User-agent: * on one line, an empty Disallow: on the next (empty means nothing is blocked), and a Sitemap line with the full URL of your sitemap. That says every crawler is welcome everywhere and here is the list of URLs. Add rules only when you have a real reason to keep crawlers out of specific paths.

Comments start with a hash sign and run to the end of the line. Blank lines separate groups. Field names such as User-agent and Disallow are not case sensitive, but path values are, so /Admin and /admin are different paths. The generator always emits at least one rule per group, because a User-agent line with no rules beneath it is not a valid group.

A WordPress file with two AI opt-outs

Here is what the WordPress preset looks like after adding two AI training opt-outs. Search engines can crawl everything except the dashboard and internal search; OpenAI's training crawler and Google's Gemini training token are both disallowed.

User-agent: *
Allow: /wp-admin/admin-ajax.php
Disallow: /wp-admin/
Disallow: /?s=
Disallow: /search/

User-agent: GPTBot
Disallow: /

User-agent: Google-Extended
Disallow: /

Sitemap: https://www.example.com/sitemap.xml

Two details matter. First, GPTBot and Google-Extended each have their own group, so they follow only those groups and ignore the wildcard rules above them. Second, Google-Extended is a robots.txt token, not a separate crawler: blocking it opts your content out of Gemini training and grounding, but it has no effect on Google Search rankings, indexing or AI Overviews.

Rules that come up on almost every site

Block admin and account areas such as /wp-admin/, /account/ and /checkout/, which have no value in search. Remember the file is public, so never list paths whose existence you want to keep secret; use a login for those.

Keep CSS and JavaScript crawlable. If a legacy rule blocks /assets/, add Allow: /assets/*.css and Allow: /assets/*.js so Google can render pages properly. Block parameter URLs that create endless duplicates, such as Disallow: /*?sort= and Disallow: /*?sessionid=, which keeps crawlers out of filter and sort combinations. Our crawl budget guide explains when that is worth doing and when it is premature.

Deciding on AI crawlers deliberately

AI user agents fall into two groups. Training crawlers gather text for future models: GPTBot (OpenAI), ClaudeBot (Anthropic), CCBot (Common Crawl), Bytespider (ByteDance), Meta-ExternalAgent and the Google-Extended and Applebot-Extended tokens. Answer crawlers fetch pages to cite in live results: OAI-SearchBot for ChatGPT search, Claude-SearchBot, and PerplexityBot. ChatGPT-User fetches a page only when a person asks ChatGPT to open it.

The "Block AI training bots" preset disallows the training group while leaving search engines and answer crawlers allowed, which is the most common middle ground: stay citable in AI answers without donating content to model training. If you want a file built around AI choices alone, the AI Bot Robots.txt Generator goes deeper on that list.

Crawl-delay, and why it is usually left blank

Crawl-delay asks a crawler to wait a number of seconds between requests. Bing and Yandex respect it; Googlebot ignores it and adjusts its own rate based on how your server responds. Writing Crawl-delay: 10 does nothing for Google but slows Bing to one request every ten seconds, which can delay indexing of new pages there. Use it only for a specific bot that is genuinely straining your server.

How groups and precedence actually work

A crawler picks the single most specific group that names it and obeys only that group. It does not merge the wildcard group with its own named group. So if your User-agent: * group blocks /cart/ and you add a User-agent: GPTBot group that only allows /blog/, GPTBot ignores the /cart/ rule completely. If a named crawler should also follow your shared rules, repeat them inside its group. If the same crawler appears in two groups, Google merges them, and the generator warns you so you can tidy them into one.

Inside a group, order does not decide the outcome for Google or Bing. The longest matching path wins, and when an Allow and a Disallow are equally long, Allow wins. The asterisk matches any characters and the dollar sign anchors the end of the URL, so Disallow: /*.pdf$ blocks URLs ending in .pdf but not /guide.pdf-notes. Only those two special characters are supported; other regex syntax is treated as literal text.

Uploading the file on your platform

WordPress

Paste the output into Yoast SEO (Tools, File editor) or Rank Math (General Settings, Edit robots.txt), or upload robots.txt to the site root over FTP, which replaces WordPress's virtual file.

Shopify

Create a robots.txt.liquid template in the theme code editor. Keep Shopify's default rules for checkout and cart, and add your own groups below them.

Nginx, Apache or a static host

Put the file in the public web root so it is served at /robots.txt with a 200 status and a text/plain content type. Google follows up to five redirects to reach it, but serving it directly is safer. Each subdomain needs its own copy.

Testing before and after you publish

Before you replace the live file, check the new rules against a list of your most important URLs and confirm none of them would be blocked. After deploying, run the live Robots.txt Tester to see how 25+ search and AI crawlers now treat your site. Google can take up to a day to pick up the new version; the robots.txt report in Search Console shows which version it fetched last.

Keep the file in version control with a note on why each rule exists. A robots.txt nobody understands is a robots.txt nobody dares change, and stale rules quietly block sections that later become important.

How it works

  1. Configure Your Rules

    Select which crawlers to allow or disallow, set crawl delay preferences, and add the paths you want restricted.

  2. Add Sitemap Reference

    Include your XML sitemap URL so search engines can find your full page index.

  3. Copy or Download

    Get your finished robots.txt ready to upload to your server root or paste into your CMS settings.

Frequently asked

What should every robots.txt include?

›

At minimum a User-agent group and a Sitemap line with the full URL of your XML sitemap. Add Disallow rules only for paths with no search value, such as admin areas, carts and internal search. Many sites also add explicit groups for AI training crawlers so the decision is deliberate rather than a default.

Which presets does the generator offer?

›

Five: allow everything, block admin areas, a WordPress set (blocks /wp-admin/ but keeps admin-ajax.php open, plus internal search URLs), block AI training bots, and block everything for a staging site. You can edit any preset, add more groups and pick crawlers from a list.

How do I stay in ChatGPT search but opt out of AI training?

›

Disallow GPTBot, OpenAI's training crawler, and leave OAI-SearchBot allowed, since that is the crawler behind ChatGPT search results. The same split works for Anthropic (ClaudeBot for training, Claude-SearchBot for search). The 'Block AI training bots' preset sets this up while leaving search engines allowed.

Should I use Crawl-delay?

›

Usually not. Googlebot ignores Crawl-delay and sets its own rate based on how your server responds. Bing and Yandex respect it, so a large value can slow their indexing of new pages. The generator warns you when you set one. Use it only for a specific bot that is genuinely straining your server.

Why does a named bot ignore my wildcard rules?

›

A crawler obeys only the most specific group that names it. If you add a 'User-agent: GPTBot' group, GPTBot follows that group and ignores everything under 'User-agent: *'. Repeat any shared rules inside the named group if you still want them applied.

Can I block URL parameters with robots.txt?

›

Yes, with wildcards. 'Disallow: /*?sort=' blocks any URL containing ?sort=, and 'Disallow: /*?' blocks every URL with a query string, which is often broader than intended. Paste the result into the Robots.txt URL Tester with real URLs from your site to confirm the wildcard catches only what you meant.

Where do I upload the file?

›

At the root of each host: https://www.example.com/robots.txt. Subfolders are ignored, and each subdomain needs its own file. On WordPress you can paste it into Yoast or Rank Math's file editor; on Shopify, edit the robots.txt.liquid theme template.

Should I block staging sites with robots.txt?

›

Not on its own. Robots.txt is public and only a request, and blocked URLs can still be indexed from links. Protect staging with a password (HTTP authentication) or an IP allowlist, and add a noindex header as a second layer.

Related tools

More Technical SEO tools

See all Technical SEO tools · All free SEO tools

Related guides

↳ full site audit190+ checks · AI fix instructions · yearly plans