HTML Formatterhtmlformatteronline.com

robots.txt generator

Pick your rules and read back, in plain English, what the file will actually do. The syntax has more traps than it looks like it should.

Overall
Paths
Bots
What this file does
robots.txt

What robots.txt can and cannot do

robots.txt is a request, not a lock. Well-behaved crawlers read it and obey. Badly behaved ones read it to find out where the interesting directories are. It is a crawl-budget tool, not a security tool.

Never use it to hide anything sensitive. The file is public at /robots.txt on every site that has one. Listing /admin-panel/ there advertises the path to anyone curious enough to look. Use authentication for anything that must stay private.

Disallow does not mean deindex

This is the single most misunderstood thing about the file, and it costs people real traffic.

Disallow stops a crawler fetching a URL. It does not remove that URL from search results. If other pages link to it, Google can still list it — as a bare URL with no title and no description, because it was never allowed to look at the page.

Worse, blocking a page in robots.txt means the crawler never sees a noindex tag on it. The two instructions fight, and the block wins.

What you wantWhat to use
Page out of the index<meta name="robots" content="noindex">, and let it be crawled
Stop wasting crawl budget on junk URLsDisallow in robots.txt
Page gone right nowRemovals tool in Search Console, then noindex
Page behind a loginAuthentication. Not robots.txt.

The meta tag generator produces the noindex tag when you need one.

Syntax rules worth knowing

  • The file must be at the domain root — /robots.txt, nowhere else. A file in a subfolder is ignored entirely.
  • It applies per host and per protocol. https://example.com and https://shop.example.com need their own files.
  • Paths are case-sensitive. /Admin/ does not block /admin/.
  • A trailing slash matters: Disallow: /private blocks /private-notes.html too. Disallow: /private/ blocks only the folder.
  • * matches any sequence, $ anchors the end. Disallow: /*.pdf$ blocks PDFs.
  • A crawler obeys the single most specific matching user-agent block and ignores all the others — so a rule you put under User-agent: * does not apply to a bot that has its own block.
  • An empty Disallow: means allow everything. Disallow: / means block everything. One character between those two.

Never block your CSS or JavaScript

Google renders pages the way a browser does. If your stylesheet or scripts are blocked, it sees an unstyled document, cannot judge mobile-friendliness, and may not see content your JavaScript inserts.

Blocking /assets/ or /wp-includes/ was standard advice in 2012 and is actively harmful now. Search Console's URL Inspection tool shows you the rendered page — if it looks broken there, something is blocked.

The AI crawler question

There is no settled answer, and anyone telling you there is has a position to sell. The trade-off:

Blocking keeps your writing out of training sets and saves some server load. For a site whose content is the product — original research, a paid archive — that can be the right call.

Allowing keeps you eligible to be cited when an assistant answers a question in your area. That referral traffic is small today and growing.

The two are also not one decision. GPTBot and Google-Extended are training crawlers; OAI-SearchBot and PerplexityBot fetch pages to answer a live query and cite them. Blocking the first group and allowing the second is a coherent position. The tick box above blocks both, so edit the output if you want the split.

Testing it

Search Console has a robots.txt report that shows the file Google last fetched and flags syntax errors. Use URL Inspection on a specific page to confirm whether it is blocked.

A mistake here is unusually expensive. A stray Disallow: / pushed to production can take a site out of search within days, and recovery is slower than the fall. Check it after every deploy that touches the file — and if you use the staging preset above, make very sure it does not ship.

Questions about this generator

Do I even need a robots.txt file?

Not strictly — a missing file means everything is crawlable, which is the right answer for most small sites. It is still worth having one, if only to declare your sitemap. An empty or missing file is fine; a wrong one is expensive.

Why is a blocked page still showing in Google?

Because blocking a page stops it being crawled, not indexed. If other sites link to it, the URL can be listed with no title or snippet. To remove it properly, unblock it and add a noindex meta tag so the crawler can actually read the instruction.

Does Google respect Crawl-delay?

No, it ignores the directive entirely. Bing, Yandex and several smaller crawlers respect it. To slow Google down, use the crawl rate setting in Search Console.

Should I block SEO crawlers like Ahrefs?

It saves bandwidth and makes your backlink profile harder for competitors to study. It also means your own audits in those tools stop working, and third-party data about your site disappears. Most sites leave them alone; high-traffic sites with a real bandwidth cost often block them.

Can I have different rules for different subdomains?

You must — each subdomain needs its own file, because robots.txt applies per host. shop.example.com/robots.txt is completely separate from example.com/robots.txt.

Related tools

Learn the why, not just the how

Longer reading on formatting, indentation and minification.