A robots.txt generator builds the plain-text file that tells crawlers which parts of your site to skip. You choose a user agent, add Disallow and Allow paths, include your sitemap URL, and download the result. The examples below cover the setups most sites need, ready to copy as-is or recreate in a generator.
Two rules make every example easier to read. First, a crawler obeys only the most specific group that names it: if you write a group for Googlebot, Googlebot ignores the * group entirely, so repeat any shared rules. Second, Google and Bing support * as a wildcard and $ for “ends here,” but smaller crawlers may not.
Replace example.com with your own domain in every snippet. For the basics of crawling versus indexing, see robots.txt and XML sitemaps explained.
Try it: Robots.txt GeneratorCreate a correct robots.txt with rules per crawler, crawl-delay, sitemap links and a one-click preset to block AI crawlers.
Open tool — freeBasic robots.txt examples
Allow everything
This is the right file for most small sites. An empty Disallow: means nothing is blocked.
User-agent: *
Disallow:
Sitemap: https://www.example.com/sitemap.xmlA missing robots.txt (a 404) has the same effect, but having the file lets you advertise your sitemap.
Block everything (staging and development sites)
User-agent: *
Disallow: /Use this on a staging copy, never on a live site. And treat it as a courtesy sign, not a lock. It doesn’t stop a URL from being indexed if someone links to it, and it doesn’t stop people from visiting. Password protection on the staging server is the real fix. The classic disaster is copying this file to production during a launch, so check robots.txt on launch day.
Block a folder, a file or a file type
User-agent: *
Disallow: /private-drafts/
Disallow: /old-price-list.html
Disallow: /*.pdf$
Disallow: /*?sessionid=Line by line: a whole folder, one page, every URL ending in .pdf, and any URL containing a session parameter. Watch your trailing slashes. Disallow: /blog also blocks /blog-news/ and /blogroll, because rules match the start of the path. Disallow: /blog/ blocks only that folder.
WordPress and WooCommerce robots.txt examples
WordPress
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Disallow: /?s=
Disallow: /search/
Sitemap: https://www.example.com/sitemap_index.xmlThe first two rules match what WordPress serves by default. The search lines stop crawlers from wandering through endless internal search result pages. Point the sitemap line at whichever sitemap is active: /wp-sitemap.xml for core WordPress, or /sitemap_index.xml if you use Yoast or Rank Math.
Notice what’s missing. Old guides told you to block /wp-includes/ and /wp-content/plugins/. Don’t. Those folders hold the CSS and JavaScript Google needs to render your pages.
WooCommerce
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/
Disallow: /*?add-to-cart=
Disallow: /?s=
Sitemap: https://www.example.com/sitemap_index.xmlCart, checkout and account pages are personal to each visitor and have nothing to rank, and add-to-cart links can create thousands of crawlable variations. These paths assume WooCommerce’s default page slugs. If your store is in another language or you renamed the pages, use your real slugs.
Be careful with product filters and sorting parameters. Blocking them saves crawl effort on large catalogs, but on a small store it’s usually unnecessary, and a wildcard that’s too broad can block real category pages.
Shopify: edit robots.txt.liquid instead
You can’t upload a robots.txt file to Shopify. Every store gets one generated automatically, with sensible rules for the cart, checkout, admin and internal search, plus a sitemap link. For most stores, the right move is to leave it alone.
If you do need changes, such as blocking AI crawlers, you add a robots.txt.liquid template in your theme’s code editor. Shopify’s help documentation shows the default template, which outputs its standard rules. Keep that part and add your own lines, rather than replacing everything with a hand-written file. Otherwise you lose rules Shopify keeps updated for you.
How to block AI crawlers in robots.txt
Several AI companies publish the user agent names their crawlers use and say they honor robots.txt. You can list several user agents in one group, which keeps the file short:
User-agent: GPTBot
User-agent: ChatGPT-User
User-agent: CCBot
User-agent: Google-Extended
User-agent: ClaudeBot
User-agent: PerplexityBot
Disallow: /
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://www.example.com/sitemap.xml| User agent | Company | What blocking it does |
|---|---|---|
| GPTBot | OpenAI | Opts out of crawling for model training |
| ChatGPT-User | OpenAI | Covers pages fetched when a ChatGPT user asks for them; check OpenAI’s docs for how it treats these requests |
| CCBot | Common Crawl | Keeps pages out of the open web dataset many AI models are trained on |
| Google-Extended | Opts out of some Gemini AI uses; has no effect on Google Search | |
| ClaudeBot | Anthropic | Opts out of crawling for model training |
| PerplexityBot | Perplexity | Keeps pages out of Perplexity’s search index |
Google-Extended deserves a note. It isn’t a separate crawler. Googlebot still crawls your site, and blocking Google-Extended doesn’t change your rankings or your presence in Google Search. Blocking Googlebot by mistake, on the other hand, would remove you from search entirely.
Think about trade-offs before blocking everything. Some of these bots power AI search answers that can send visitors your way. OpenAI, for example, uses a separate agent, OAI-SearchBot, for ChatGPT search. Crawler names also change and new ones appear, so check each company’s documentation once in a while.
Common robots.txt mistakes
- Blocking CSS and JavaScript. If Google can’t load your styles and scripts, it may see a broken page and judge it accordingly.
- Using robots.txt to hide pages. A blocked URL can still appear in search results if other pages link to it. To keep a page out of Google, leave it crawlable and add a
noindextag. A blocked page’s noindex is never seen. - Listing secret folders. Robots.txt is public. Anyone can read it, so it’s a map, not a lock.
- Expecting Crawl-delay to work on Google. Googlebot ignores it. Bing respects it, but most sites don’t need it.
- Forgetting other hosts. Each subdomain, such as
shop.example.com, needs its own robots.txt.
Building your file with a robots.txt generator
Typing rules by hand is fine for three lines. Beyond that, a generator avoids typos like a missing colon or a misspelled user agent. Our free robots.txt generator runs in your browser:
- Start with the group for all crawlers and leave crawling allowed by default.
- Add the paths you want blocked, one per line, taken from the examples above.
- If you want to opt out of AI crawlers, apply the AI crawler preset, then review the user agents it adds and remove any you’d rather allow.
- Add a crawl-delay only if a specific crawler is straining your server.
- Enter your sitemap URL, then download the file.
- Upload
robots.txtto the root of your domain and open it in a browser to confirm it’s live.
Pick the smallest file that does the job
For most sites, the right robots.txt is short: allow everything, block admin or search pages if your platform creates them, list your sitemap, and decide deliberately about AI crawlers. Start from the closest example here, adjust it in the generator, and recheck the live file after every site launch or migration.
Frequently asked questions
What is the best robots.txt for WordPress?
For most WordPress sites, block /wp-admin/ while allowing /wp-admin/admin-ajax.php, optionally block internal search, and add your sitemap URL. Avoid blocking theme and plugin folders, because Google needs the CSS and JavaScript to render pages.
Does blocking Google-Extended affect my Google rankings?
No. Google-Extended only controls whether your content is used for some of Google's AI models, and Google states it does not affect ranking or inclusion in Google Search.
Can I edit robots.txt on Shopify?
Shopify generates a robots.txt for every store automatically. To change it, add a robots.txt.liquid template in your theme code, ideally keeping Shopify's default rules and adding your own on top.
Is an empty robots.txt file OK?
Yes. An empty file, or no file at all, means crawlers may access everything. Adding a Sitemap line is still worthwhile.



