Back to Tools

Robots.txt Generator

Generate custom robots.txt files to control crawler access

SEO Tool

Quick Presets

Search Engines

AI Bot / LLM

Social Media

Other Crawlers

Disallowed Paths

Sitemap

Enter the full URL of your XML sitemap

Crawl Delay

Minimum time between crawler requests (0-60 seconds)

robots.txt Output

# robots.txt generato con Robots.txt Generator
# https://marketing-tools.example.com

User-agent: *
Allow: /

Complete Guide to Robots.txt

What is Robots.txt and Why It Matters

The robots.txt file is one of the internet's oldest yet most powerful tools for website control. Placed in your site's root directory, it acts as a "traffic cop" for web crawlers—telling search engines, AI bots, and other automated visitors which parts of your site they can access.

While search engines like Google respect these directives (though they're not legally enforceable), a properly configured robots.txt file is essential for SEO, bandwidth management, and protecting sensitive content from being indexed or scraped by AI training models.

Key Scenarios for Robots.txt

Protecting Private Areas

Block access to admin panels, staging environments, or internal documentation. While not a security measure (real protection requires authentication), robots.txt prevents accidental indexing of sensitive pages.

Blocking AI Scrapers

With the rise of GPT, Claude, and Gemini, many content creators now block AI bots (GPTBot, ClaudeBot, Google-Extended) to prevent their work from training commercial models without compensation.

Managing Crawl Budget

Large sites can exhaust their "crawl budget"—the number of pages Googlebot will crawl in a session. Block low-value pages (pagination, filters, thank-you pages) to prioritize important content.

Preventing Duplicate Content

E-commerce sites often have multiple URLs for the same product (sorted, filtered). Robots.txt can block these variations to avoid duplicate content penalties.

Understanding User-Agent Directives

The robots.txt file uses "User-Agent" to target specific bots:

  • User-agent: * – Applies to all bots (wildcard)
  • User-agent: Googlebot – Specific rule for Google's crawler
  • User-agent: GPTBot – Targets OpenAI's training bot

More specific rules override general ones. If you block Googlebot specifically but allow all others with *, Google will still be blocked.

Blocking AI Bots: The New Frontier

In 2023-2024, major AI companies began acknowledging robots.txt for training data collection. Here's how to block the most common AI scrapers:

# Block OpenAI (ChatGPT training)
User-agent: GPTBot
Disallow: /

User-agent: ChatGPT-User
Disallow: /

# Block Google AI (Bard/Gemini training - NOT search)
User-agent: Google-Extended
Disallow: /

# Block Anthropic (Claude training)
User-agent: anthropic-ai
Disallow: /

User-agent: ClaudeBot
Disallow: /

# Block Common Crawl (used by many AI systems)
User-agent: CCBot
Disallow: /

Important: Blocking Google-Extended does NOT affect Google Search indexing. Googlebot (for search) is separate and should remain allowed if you want organic traffic.

Best Practices for SEO

  1. Always Allow Search Engines: Never block Googlebot, Bingbot, or other major search crawlers unless you're intentionally de-indexing your site.
  2. Include Sitemap URL: Add Sitemap: https://yoursite.com/sitemap.xml to help search engines discover all your pages.
  3. Avoid Blocking CSS/JS: Modern Google needs to render JavaScript. Don't block /assets/ or .js files, or you may harm mobile rankings.
  4. Use Crawl-Delay Sparingly: Googlebot ignores this directive. Only use it for aggressive bots consuming excessive bandwidth (e.g., SEMrush, Ahrefs).
  5. Test Before Deploying: Use Google Search Console's robots.txt Tester to verify you haven't accidentally blocked critical pages.
  6. Keep It Simple: Overly complex robots.txt files can confuse crawlers. Block only what's necessary.

Common Mistakes to Avoid

  • Blocking Entire Site: Disallow: / for User-agent: * will deindex your entire website from search engines.
  • Typos in Bot Names: User-agent: GoogleBot (capital B) won't work—it's case-sensitive (Googlebot).
  • Missing Final Slash: Disallow: /admin blocks /admin but also /administrator. Use /admin/ for folders.
  • Using It for Security: Robots.txt is public and doesn't enforce access control. Hackers can read it to find sensitive paths. Use .htaccess or authentication instead.
  • Blocking Already Indexed Pages: If Google already indexed a page, robots.txt won't remove it. Use noindex meta tags and Google Search Console removal requests.

Advanced Syntax Examples

# Block all PDFs from all bots
User-agent: *
Disallow: /*.pdf$

# Allow Googlebot but block everyone else
User-agent: Googlebot
Allow: /

User-agent: *
Disallow: /

# Block dynamic URLs with parameters
User-agent: *
Disallow: /*?*

# Block specific folders for all bots
User-agent: *
Disallow: /private/
Disallow: /temp/
Disallow: /backup/

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

Frequently Asked Questions

Does robots.txt actually prevent access?

No. Robots.txt is a voluntary protocol. Ethical bots (Google, Bing) respect it, but malicious scrapers ignore it. For true access control, use authentication (.htaccess, login systems).

Can I use robots.txt to hide pages from Google?

Sort of. Blocking a page prevents crawling, but if other sites link to it, Google may still index the URL (without content). For complete removal, use <meta name="robots" content="noindex">.

Should I block AI bots from my blog?

It depends. If you're a publisher concerned about content being used for AI training without compensation, blocking GPTBot and similar crawlers makes sense. However, future AI-powered search may drive traffic, so consider your long-term strategy.

What's the difference between Googlebot and Google-Extended?

Googlebot: Crawls for Google Search indexing. Google-Extended: Crawls for AI training (Bard/Gemini). You can block Extended while allowing Googlebot to maintain search visibility.

How do I test my robots.txt file?

Use Google Search Console's robots.txt Tester tool. It shows how Googlebot interprets your file and lets you test specific URLs to see if they're blocked.

Does robots.txt affect page speed or SEO rankings?

No direct impact on speed. For SEO, improper use (blocking important pages) can tank rankings. Correct use (blocking duplicates, managing crawl budget) can improve SEO by helping Google focus on valuable content.

About the Author: Nicola Selenu

Nicola is a Lead Developer and Digital Marketing Technologist with years of hands-on experience in technical SEO, web analytics, and deliverability. He builds tools to bridge the gap between complex marketing technicalities and easy-to-use solutions.