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
- Choose your crawl rules. Pick which bots to target (e.g.
Googlebot, all bots via*, or specific crawlers). - Add Disallow paths. Enter the URL paths you want blocked — like
/admin/or/private/. - Add Allow paths (optional). If a parent folder is blocked but one sub-path should stay open, list it here.
- Set a Crawl-delay (optional). Give slow servers breathing room by limiting how fast a bot visits.
- Add your Sitemap URL. Paste your XML sitemap URL so crawlers can find it instantly.
- 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.xmlUpload 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:
| Directive | What it does | Example |
|---|---|---|
| User-agent | Names the bot the rules apply to. Use * for all bots. | User-agent: Googlebot |
| Disallow | Tells the bot: do not crawl this path or file. | Disallow: /cart/ |
| Allow | Opens a specific path inside a blocked parent folder. | Allow: /wp-admin/admin-ajax.php |
| Crawl-delay | Seconds the bot waits between requests. Eases server load. | Crawl-delay: 10 |
| Sitemap | Points 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
noindexmeta 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.