Robots.txt Generator

Free tool

Robots.txt Generator

Build a valid robots.txt without memorising the syntax. Pick a policy, add the paths you want kept out of the index, and download the file.

User-agent: * Disallow:

Upload the finished file to the root of your domain, so it answers at /robots.txt.

How it works

Choose a default policy

Allow everything, block everything, or allow only the major search engines. This becomes the first block in the file.

Add your exceptions

List the paths crawlers should skip — admin screens, carts, internal search results. Allow rules override a broader Disallow.

Download and upload

Copy the output or download robots.txt, then place it in the root of your domain so it answers at yoursite.com/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 ignore it entirely. It controls crawling, not indexing. A page blocked in robots.txt can still appear in search results if other sites link to it — Google simply shows it without a description, because it was never allowed to look.

If you genuinely need a page kept out of the index, use a noindex meta tag or an HTTP header and let crawlers reach the page to see it. Blocking the URL in robots.txt actively prevents the noindex tag from ever being read.

The rules worth knowing

Paths are matched from the start of the URL, so Disallow: /cart also blocks /cart-abandoned/. Use a trailing slash when you mean a directory. The asterisk matches any sequence of characters and the dollar sign anchors the end, so Disallow: /*.pdf$ blocks every PDF.

Where two rules conflict, Google applies the most specific one, not the first one. That is why an Allow for a single file inside a disallowed directory works exactly as you would hope.

Blank lines separate groups. A User-agent line starts a new group, and every rule under it belongs to that agent until the next one. Getting this wrong is the single most common robots.txt mistake — rules stranded under the wrong agent do nothing at all.

A sensible starting point for WordPress

Most WordPress sites need very little: allow everything, disallow /wp-admin/, explicitly allow /wp-admin/admin-ajax.php so front-end features keep working, and point to your sitemap. Blocking /wp-includes/ or your theme directory is an old habit that now does more harm than good, because it stops Google rendering your pages properly.

Frequently asked questions

Where does the robots.txt file go?

In the root directory of the domain, so it is served at https://yoursite.com/robots.txt. A file in a subfolder is ignored, and each subdomain needs its own.

Does blocking a page in robots.txt remove it from Google?

No. It stops Google crawling the page, but the URL can still be listed if other pages link to it. To remove a page from the index, allow crawling and add a noindex meta tag, or use the removal tool in Search Console.

What does Crawl-delay do?

It asks a crawler to wait the given number of seconds between requests. Bing and Yandex respect it. Google ignores it entirely and expects you to set the crawl rate in Search Console instead.

Should I block SEO crawlers such as AhrefsBot?

Only if you have a reason to. Blocking them hides your backlink profile from competitors using those tools, but it also hides it from you, and it does nothing for your search rankings either way.

Can I have more than one Sitemap line?

Yes. List as many as you need, each on its own line, using the full absolute URL. Sitemap directives are independent of user-agent groups, so their position in the file does not matter.

Related tools

Related reading

Scroll to Top