How to Make a robots.txt File (and What It Can and Cannot Do)
Updated November 2026
Written by the Toolpuffin team. Tools in this guide are tested in the browser.
A robots.txt file is a small text file that tells crawlers, such as search engine bots, which parts of your website they may visit. It is easy to make, and just as easy to get wrong. This guide shows what goes in it, where it goes and what it cannot do.
What a robots.txt file does
Crawlers ask for the file before they visit the rest of your site. Inside, you list rules: which crawler a rule is for, and which paths it may or may not visit. Well-behaved crawlers, including those of the big search engines, follow these rules.
Google describes it as a way to manage crawler traffic, for example to keep a crawler from overloading your site. It is not a way to keep a page out of search results.
What the file looks like
Each group starts with a User-agent line, followed by the rules for that crawler. A star means every crawler. Disallow lists a path that should not be visited, and Allow makes an exception. A Sitemap line points to your sitemap with its full web address.
- User-agent: * means the rules below are for all crawlers.
- Disallow: /private/ blocks everything in the folder /private/.
- Disallow: / blocks the whole site, so use it with care.
- Allow: /private/public-page.html makes an exception inside a blocked folder.
- Sitemap: https://example.com/sitemap.xml tells crawlers where your sitemap is.
Where the file goes
Put it in the top folder of your site, so that it opens at https://yourdomain.com/robots.txt. A robots.txt file in a subfolder is not read, and every domain or subdomain needs its own file.
What it cannot do
- It does not hide a page. A blocked address can still show up in search results if other sites link to it. To keep a page out of search results, use a noindex tag or put the page behind a password.
- It is not security. Anyone can open your robots.txt and read the paths in it, and a crawler that ignores the rules is not stopped by it.
- A page that is blocked in robots.txt cannot be read, so a noindex tag on that page will not be seen. Pick one approach per page.
Make one in a minute
Choose what to block, add the crawlers you want to keep out and your sitemap, and copy or download the file. Check the result before you upload it, because one wrong line can block more than you meant.
If you are also setting up the title and description for your pages, the meta tag generator makes those tags.