Robots.txt generator

Create a valid robots.txt that tells search engines what to crawl and what to skip — including your sitemap location.

Robots.txt Generator

Create a valid robots.txt that tells search engine crawlers what to index and what to skip — plus your sitemap location.

Generated File

robots.txt — place at your site root

What Robots.txt Does (and Doesn’t Do)

robots.txt is the first file well-behaved crawlers request from your domain. It controls crawling — which paths bots may fetch — which protects your crawl budget and keeps utility pages (carts, admin panels, internal search results) from wasting Google’s attention on your site.

Two traps to avoid: robots.txt is not security — blocked paths are still publicly listed in the file itself, so never use it to “hide” sensitive URLs. And blocking a page does not remove it from Google’s index if other sites link to it; for that, use a noindex meta tag and let the page be crawled. Always include your sitemap line — it is the cheapest indexing hint there is.

What robots.txt controls — and what it doesn't

robots.txt is the first file a well-behaved crawler requests from your domain. It controls crawling: which paths bots may fetch. That protects your crawl budget and stops search engines wasting attention on carts, admin panels and internal search results.

What it does not control is indexing. This distinction causes more SEO damage than any other robots.txt misunderstanding. If another site links to a page you've disallowed, Google can still list that URL in search results — it simply won't have crawled the content, so it shows a bare URL with no description. To keep a page out of the index you must let it be crawled and serve a noindex meta tag. Blocking it in robots.txt actively prevents Google from seeing that tag.

The mistake that deindexes entire sites

A single line — Disallow: / — blocks your whole site. It's the correct setting for a staging environment, and catastrophic on production. The classic disaster is a staging robots.txt being deployed to live, and it happens often enough that checking robots.txt should be a standard post-deploy step.

Two subtler traps: robots.txt must live at the domain root (example.com/robots.txt) — anywhere else and it's ignored entirely. And it doesn't apply across subdomains, so blog.example.com needs its own file.

Never use it to hide sensitive paths

robots.txt is a public file that anyone can read, and listing a path there advertises its existence. Writing Disallow: /admin-panel-v2/ tells every curious visitor exactly where to look. It's an instruction to polite crawlers, not an access control, and malicious bots ignore it completely.

Anything genuinely sensitive needs authentication, not a crawler directive. Our security essentials covers the difference between obscurity and actual protection.

Always declare your sitemap

Adding a Sitemap: line is the cheapest indexing help available. It works for every major search engine, requires no account, and gives crawlers a direct route to every URL you care about. Use the absolute URL, and note that this directive is independent of user-agent groups — it applies globally wherever you place it.

After changing robots.txt, test it. Google Search Console's robots.txt report shows exactly how Googlebot interprets your file, which is far more reliable than reading the rules yourself and hoping.

Frequently asked questions

Does robots.txt stop a page appearing in Google?

No. It stops crawling, not indexing. A disallowed page can still be listed if other sites link to it — Google just shows the bare URL with no description. To keep a page out of the index, allow crawling and use a noindex meta tag instead.

Where does robots.txt need to be located?

At the root of the domain, for example example.com/robots.txt. Placed anywhere else it is ignored completely. Each subdomain needs its own file — blog.example.com will not use the main domain’s robots.txt.

Can I use robots.txt to hide private pages?

No. It is a public file, so listing a path there advertises its existence to anyone who looks, and malicious bots ignore it entirely. Anything genuinely private needs authentication or server-level access control.

Should I include my sitemap in robots.txt?

Yes. A Sitemap: line with the absolute URL is the cheapest indexing hint available, works across all major search engines, and applies globally regardless of which user-agent group it sits in.