Robots.txt Generator - Build Your robots.txt File Free

Generate a valid robots.txt file in seconds. Block bots, set crawl rules, add your sitemap — free, no sign-up, runs in your browser.

robots.txt
User-agent: *
Disallow: /admin
Disallow: /cart
Disallow: /checkout

Build a Valid robots.txt File in Seconds

Fill in the form above, click generate, and you get a ready-to-upload robots.txt file — no guessing, no typos, no manual formatting. Drop it at your site root and search engines will respect your crawl rules immediately.

This robots txt generator works entirely in your browser. Nothing you enter is sent to a server, so your URLs and site structure stay completely private.

How to Use the Robots.txt Generator

  1. Choose your crawl rules. Pick which bots to target (e.g. Googlebot, all bots via *, or specific crawlers).
  2. Add Disallow paths. Enter the URL paths you want blocked — like /admin/ or /private/.
  3. Add Allow paths (optional). If a parent folder is blocked but one sub-path should stay open, list it here.
  4. Set a Crawl-delay (optional). Give slow servers breathing room by limiting how fast a bot visits.
  5. Add your Sitemap URL. Paste your XML sitemap URL so crawlers can find it instantly.
  6. Click Generate. Copy the output or download the file, then upload it to yourdomain.com/robots.txt.

Worked Example: A Typical Blog Setup

Say you run a WordPress blog. You want Google to crawl your posts and pages freely, but block the /wp-admin/ folder and the login page. You also want to expose your sitemap. Here is the input you would enter and the output you would get:

Your input:

  • User-agent: * (all bots)
  • Disallow: /wp-admin/
  • Disallow: /wp-login.php
  • Allow: /wp-admin/admin-ajax.php (needed for some plugins)
  • Sitemap: https://yourblog.com/sitemap.xml

Generated output:

User-agent: *
Disallow: /wp-admin/
Disallow: /wp-login.php
Allow: /wp-admin/admin-ajax.php

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

Upload that file to https://yourblog.com/robots.txt and you are done. Google's crawler will read it on the next visit.

Understanding Your robots.txt File — Quick Reference

Here is what each line in the file means at a glance:

DirectiveWhat it doesExample
User-agentNames the bot the rules apply to. Use * for all bots.User-agent: Googlebot
DisallowTells the bot: do not crawl this path or file.Disallow: /cart/
AllowOpens a specific path inside a blocked parent folder.Allow: /wp-admin/admin-ajax.php
Crawl-delaySeconds the bot waits between requests. Eases server load.Crawl-delay: 10
SitemapPoints crawlers straight to your XML sitemap URL.Sitemap: https://example.com/sitemap.xml

The file lives at exactly /robots.txt — the very root of your domain. A file at /blog/robots.txt will be ignored by most crawlers.

How to Create a robots.txt File in Code

If you manage a large site programmatically, you can generate the file with a script instead of a GUI tool. Two quick examples:

Python

# Python 3 — write a robots.txt to disk
lines = [
    'User-agent: *',
    'Disallow: /admin/',
    'Disallow: /private/',
    'Allow: /admin/public-api/',
    '',
    'Sitemap: https://example.com/sitemap.xml',
]
with open('robots.txt', 'w') as f:
    f.write('
'.join(lines))

JavaScript (Node.js)

// Node.js — write a robots.txt to disk
const fs = require('fs');

const content = [
  'User-agent: *',
  'Disallow: /admin/',
  'Disallow: /private/',
  'Allow: /admin/public-api/',
  '',
  'Sitemap: https://example.com/sitemap.xml',
].join('
');

fs.writeFileSync('robots.txt', content, 'utf8');

Both scripts produce exactly the same plain-text output. The robots.txt format has no encoding tricks — it is always UTF-8 plain text with one directive per line.

How the Generator Works

The tool reads your form selections and assembles them into the Robots Exclusion Protocol format — the open standard that defines how crawlers read this file. It groups rules under the correct User-agent blocks, orders Allow before Disallow where needed (more specific rules first), and appends the Sitemap line at the end.

Everything runs locally in JavaScript inside your browser tab. No account, no upload, no tracking of your URLs.

When to Use a robots.txt File — and When Not To

Use robots.txt to:

  • Keep crawler bots out of admin panels, staging environments, and internal search results pages.
  • Prevent duplicate content from being indexed (e.g. filter/sort URL variations).
  • Reduce server load by limiting how often aggressive crawlers visit.
  • Point crawlers to your sitemap quickly, even if you have not submitted it to Google Search Console yet.

Do NOT rely on robots.txt to:

  • Hide sensitive data. The file is public. Any human (or bad bot) can read it and know exactly which paths you blocked.
  • Prevent a page from appearing in search results. A page can still show up in Google even if crawling is blocked, if other sites link to it. Use a noindex meta tag or HTTP header to keep pages out of search results entirely.
  • Block all bots unconditionally. Malicious scrapers ignore the protocol. It only works with cooperative crawlers (Google, Bing, etc.).

For the official crawl rules specification, see Google's robots.txt documentation.

One Final Tip

After uploading your file, test it straight away using Google Search Console → Robots.txt Tester (or the URL Inspection tool). It shows you exactly which paths Google will and will not crawl, so you can catch mistakes before they cost you rankings.

Ready? Use the robots txt generator above to build your file now — no sign-up needed.

Frequently asked questions

Is the robots.txt generator free?+
Yes, completely free. There is no sign-up, no subscription, and no limit on how many files you generate.
Does my data get uploaded or stored anywhere?+
No. The tool runs entirely in your browser with JavaScript. Your URLs, paths, and sitemap address never leave your device.
Where exactly do I put the robots.txt file?+
It must sit at the very root of your domain: https://yourdomain.com/robots.txt. Subdirectory placements like /blog/robots.txt are ignored by Google and most other crawlers.
What is the difference between Disallow and noindex?+
Disallow in robots.txt stops a crawler from visiting a page. noindex (a meta tag or HTTP header) tells a crawler it can visit the page but must not list it in search results. Blocking crawling with Disallow does NOT guarantee a page stays out of search results — Google can still index a URL it has never visited if other sites link to it.
Can I block only one specific search engine bot?+
Yes. Instead of User-agent: * (which targets all bots), use the specific bot name — for example User-agent: Bingbot — and then add your Disallow rules underneath. You can stack multiple User-agent blocks in the same file.
What does Crawl-delay do, and does Google respect it?+
Crawl-delay asks a bot to wait a set number of seconds between requests — useful for shared hosting or slower servers. Googlebot does not officially support the Crawl-delay directive; manage Google's crawl rate through Google Search Console instead. Bingbot and most other bots do respect it.
Do I need a Sitemap line in my robots.txt?+
It is not required, but it is strongly recommended. Adding your sitemap URL here means any crawler that reads robots.txt will find your sitemap automatically, even before you submit it manually to Search Console or Bing Webmaster Tools.
Can I have more than one robots.txt file for different subdomains?+
Yes — each subdomain can have its own robots.txt. For example, blog.example.com/robots.txt is separate from shop.example.com/robots.txt. Generate a separate file for each subdomain using the tool above.