What is a robots.txt file?
A robots.txt file is a small text file at the root of your website, at https://yourdomain.com/robots.txt. It tells search engine crawlers which parts of the site they may visit and where your sitemap is. A robots.txt generator writes that file for you, with the correct rules and spelling, so you don’t accidentally block Google from pages you want in search. Robots.txt controls crawling, not indexing. To keep a page out of Google, use a noindex tag instead (see the comparison below).
The simplest useful robots.txt allows everything and points to your sitemap:
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap.xml
Where does robots.txt go?
Always in the root folder of the domain, never in a subfolder. Search engines only look at https://example.com/robots.txt. A file at /blog/robots.txt is ignored. Each subdomain needs its own file, so shop.example.com reads shop.example.com/robots.txt. Blogger, WordPress and Shopify create the file for you, and you edit it in their settings (see the platform sections below).
How to use the robots.txt generator
- Choose your platform: Any website, Blogger, WordPress or Shopify. Each preset fills in safe default rules and the right sitemap addresses.
- Enter your website address so the sitemap lines use your domain.
- Add folders or pages to block, one per line, for example
/admin/or/cart. Leave it empty if every page may be crawled. - Optional: block AI crawlers or SEO tool bots such as GPTBot, ClaudeBot or AhrefsBot.
- Copy or download your robots.txt. The tool checks it for mistakes as you type and shows where to add it on your platform.
- Test a page with the built-in tester to confirm Google may crawl it.
Already have a robots.txt? Open the Check my robots.txt tab. It reads your live file, explains every problem in plain English and tests any page against it.
Robots.txt rules explained
| Rule | What it does | Example |
|---|---|---|
User-agent | Names the crawler the next rules are for. * means every crawler. | User-agent: Googlebot |
Disallow | A path the crawler should not visit. An empty Disallow: blocks nothing. | Disallow: /admin/ |
Allow | A path that may be crawled, even inside a blocked folder. | Allow: /admin/help |
Sitemap | The full address of your sitemap. You can list several. | Sitemap: https://example.com/sitemap.xml |
Crawl-delay | Seconds to wait between requests. Bing respects it; Google ignores it. | Crawl-delay: 10 |
* and $ | * matches any characters; $ marks the end of the URL. | Disallow: /*.pdf$ |
# | A comment. Crawlers ignore the rest of the line. | # Staging rules |
How Google decides which rule wins
- Most specific group: Googlebot follows a
User-agent: Googlebotgroup if there is one, and ignores the*group. - Longest rule wins: for
/shop/sale, the ruleAllow: /shop/salebeatsDisallow: /shop/because it is longer. - Allow wins a tie: if an Allow and a Disallow rule are the same length, the page may be crawled.
- Paths are case-sensitive:
Disallow: /Privatedoes not block/private.
The tester in this tool follows exactly these rules and shows which line decided the result.
Robots.txt examples
Allow everything (most websites)
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap.xml
Block a folder and filter pages
User-agent: *
Disallow: /admin/
Disallow: /*?sort=
Allow: /
Sitemap: https://example.com/sitemap.xml
Block one crawler, allow the rest
User-agent: GPTBot
Disallow: /
User-agent: *
Allow: /
Block everything (test or private site only)
User-agent: *
Disallow: /
Careful: “Block everything” is the most common robots.txt mistake on live websites. It is often left over from a test copy, and it stops Google from crawling the whole site. Remove it before launch.
Custom robots.txt generator for Blogger
Blogger lets you replace its default robots.txt with a custom robots.txt. The best custom robots.txt for Blogger keeps Blogger’s safe defaults, keeps the AdSense crawler allowed, and adds both of your sitemaps:
User-agent: Mediapartners-Google
Disallow:
User-agent: *
Disallow: /search
Disallow: /share-widget
Allow: /
Sitemap: https://myblog.blogspot.com/sitemap.xml
Sitemap: https://myblog.blogspot.com/sitemap-pages.xml
Mediapartners-Googleis the AdSense crawler. An emptyDisallow:lets it read every page so ads match your content.Disallow: /searchkeeps search-result and label pages (/search/label/…) out of the crawl, because they only repeat your posts.- Two sitemap lines: Blogger’s default robots.txt lists only
/sitemap.xml, so your static pages sitemap is easy to miss.
To add it, open Blogger → Settings → Crawlers and indexing, turn on Enable custom robots.txt, click Custom robots.txt, paste the file and save. Choose the Blogger preset above to get this file with your own blog address. To check that your Blogger sitemaps work and see how many posts they list, use our Blogger Sitemap Generator.
Custom robots header tags for Blogger
In the same settings section, Enable custom robots header tags controls the noindex and similar tags on each type of page. A safe setup:
| Setting | Tick | Why |
|---|---|---|
| Home page tags | all | Your homepage should be indexed. |
| Archive and search page tags | noindex | Archive and label pages repeat your posts. |
| Post and page tags | all | Your posts and pages are what you want in Google. |
Don’t combine a robots.txt block with a noindex tag on the same pages if you want them removed from Google. When a page is blocked in robots.txt, Google cannot crawl it, so it never sees the noindex tag.
Robots.txt for WordPress and Shopify
WordPress
WordPress creates a virtual robots.txt that blocks /wp-admin/ but keeps /wp-admin/admin-ajax.php open, because many themes and plugins need it. Edit it with Yoast SEO (Tools → File editor) or Rank Math (General Settings → Edit robots.txt), or upload a real robots.txt file to the root folder, which replaces the virtual one. Don’t block /wp-content/ or /wp-includes/: they hold the CSS and JavaScript Google needs to render your pages. Check which sitemap address your site uses (/wp-sitemap.xml or /sitemap_index.xml) in our WordPress sitemap guide.
Shopify
Shopify generates robots.txt automatically. It already blocks the cart, checkout, account and search pages and lists your sitemap. To add your own rules, for example to block AI crawlers, create a robots.txt.liquid template in Online Store → Themes → Edit code and add your lines below Shopify’s default code. The Shopify preset in this tool gives you only the extra lines to add.
Should you block AI crawlers?
AI companies use crawlers to collect text for training their models. You can ask them to stay away with robots.txt:
| Crawler | Company | Used for |
|---|---|---|
GPTBot | OpenAI | Training ChatGPT models |
Google-Extended | Training Gemini. It does not affect Google Search. | |
ClaudeBot | Anthropic | Training Claude models |
CCBot | Common Crawl | An open web archive many AI models are trained on |
PerplexityBot | Perplexity | Perplexity’s AI search |
Blocking these does not change your Google or Bing rankings, because Googlebot and Bingbot are separate crawlers. It is a trade-off: blocking keeps your content out of AI training, but AI tools may then mention your site less. Also remember that robots.txt is a request. Reputable crawlers follow it, but it cannot technically stop a bot that ignores it.
Robots.txt vs noindex vs sitemap
| robots.txt | noindex tag | XML sitemap | |
|---|---|---|---|
| Controls | What may be crawled | What may be indexed | What you want found |
| Where | One file for the whole site | On each page | A file listing your URLs |
| Keeps a page out of Google? | Not reliably. A blocked page can still be indexed from links | Yes | No |
| Use it for | Admin areas, filters, duplicate URL patterns | Thin or private pages | Helping Google find your important pages |
The three work together. Your robots.txt should point to your sitemap, as explained in how to add a sitemap to robots.txt. Your sitemap should list only pages that are allowed and indexable. Don’t have a sitemap yet? Create one with our free XML Sitemap Generator.
Common robots.txt mistakes
Disallow: /left over from a test site blocks Google from everything.- Blocking CSS or JavaScript folders stops Google from rendering your pages properly.
- A relative sitemap address such as
Sitemap: /sitemap.xml. It must be the full URL. - Using
Noindex:in robots.txt. Google stopped supporting it in 2019. - Blocking pages you want removed from Google. Use
noindexand let Google crawl them instead. - Typos such as
User agentorDissallow. Crawlers silently ignore lines they don’t understand. - Blocking your sitemap’s folder, which leads to “Couldn’t fetch” in Search Console. See how to fix “Couldn’t fetch”.
- A file larger than 500 KB. Google ignores everything after the first 500 KB.
How to check and test your robots.txt
- Open the file in your browser at
https://yourdomain.com/robots.txtto confirm it is live. - Run it through the Check my robots.txt tab above. It lists every problem with its line number.
- Test important pages with the tester to confirm Googlebot may crawl them.
- Check Google Search Console: Settings → robots.txt shows the version Google last read and any errors it found.
- Check your sitemap too, with our Sitemap Checker, and submit it to Google Search Console.