Robots.txt Generator

Build a robots.txt from crawl rules, without writing the syntax by hand.

robots.txt

User-agent: *
Disallow:
What goes into a robots.txt

A robots.txt file tells well-behaved crawlers which parts of your site they're welcome to fetch. It isn't a security mechanism — it's a request that legitimate crawlers (Google, Bing, and most other search engines) honor, listed as one or more User-agent blocks, each followed by Disallow and optional Allow rules, plus an optional pointer to your Sitemap.

An example robots.txt

This file lets every crawler in, keeps them out of a private area and the internal search results, and points to the sitemap:

User-agent: *
Disallow: /admin/
Disallow: /search
Allow: /

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

How the rules are matched

A crawler follows the group whose User-agent name matches it most specifically and ignores the rest. Inside that group, Google applies the longest matching path, and if an Allow and a Disallow tie, the Allow wins. Paths are case-sensitive and match from the start of the URL, so Disallow: /blog also blocks /blog-archive; add a trailing slash to block only the folder. The * wildcard matches any run of characters and $ marks the end of a URL, which is how you block a file type such as Disallow: /*.pdf$.

Mistakes to avoid

Do not use robots.txt to hide private pages: the file is public, so it lists exactly the paths you wanted to keep quiet. Do not block CSS or JavaScript that a page needs to render, because Google then sees a broken page. And do not combine Disallow with a noindex tag on the same page: the crawler never fetches the page, so it never sees the tag. The 6 robots.txt mistakes that can quietly deindex your site walks through the worst cases, and Blocked by robots.txt in Search Console explains the matching status.

Frequently asked questions

Where do I actually put the file this generates?

Save it as robots.txt (exactly that name, no extension changes) at the root of your domain — it has to be reachable at yourdomain.com/robots.txt specifically, not in a subfolder, or crawlers won't find it.

What does the empty 'Disallow:' line mean if I leave every field blank?

A Disallow line with nothing after the colon is the standard way of saying "no restrictions" for that user-agent — functionally identical to having no robots.txt at all for that crawler, but explicit about it rather than ambiguous.

When would I add more than one User-agent block?

When you want different rules for different crawlers — for example, letting Googlebot index everything while blocking a specific scraper bot, or blocking an AI-training crawler without blocking search engines. Each block only applies to the user-agent named directly above it.

Does a robots.txt rule stop a page from appearing in Google at all?

Not reliably — Disallow only asks crawlers not to fetch the page's content; if other sites link to it, Google can still index the URL itself (usually with no description) unless you also add a noindex meta tag on the page, which requires crawlers to be able to fetch it in the first place.

How do I block AI crawlers such as GPTBot with robots.txt?

Add a separate block for each crawler you want to turn away, for example User-agent: GPTBot followed by Disallow: /. Blocking an AI crawler does not affect Googlebot or Bingbot, because each block applies only to the user-agent named above it. Decide first whether you want to be cited by AI assistants; blocking them also stops them reading your pages. The AI Crawler Checker shows which of these bots your current file allows.

Do I need a Sitemap line in robots.txt?

It is optional but recommended. A line such as Sitemap: https://yourdomain.com/sitemap.xml tells every crawler where your sitemap is without you submitting it to each search engine separately. Use the full absolute URL, and you can list more than one sitemap.

Can a wrong robots.txt remove my site from Google?

A single line, Disallow: / under User-agent: *, tells every crawler to stay away from the whole site, and it is the most common cause of a site vanishing after a launch or a staging-to-live move. Always test the file after you publish it with the Robots.txt Checker.

How long until Google notices my new robots.txt?

Google caches the file and normally refetches it within about a day. If you need a change to apply sooner, you can ask Google to recrawl it from the robots.txt report in Search Console.

Read next

Related tools

We use cookies to analyze site usage and improve your experience. You can decline non-essential cookies. Privacy Policy