What is a robots.txt file?
A robots.txt file is a small text file in the root folder of your website, for example example.com/robots.txt. It tells crawlers such as Googlebot and Bingbot which parts of your site they may visit. It is the first file most bots read when they arrive.
Robots.txt is used to:
- keep crawlers out of admin areas, carts, internal search results and other low-value pages
- point bots to your XML sitemap
- allow or block specific bots, including AI training crawlers such as GPTBot and Google-Extended
- slow down aggressive crawlers with a crawl delay (Bing and Yandex respect it, Google ignores it)
How to create your robots.txt
- Choose whether all robots may crawl the site. For almost every live website, keep Allow.
- Add your sitemap URL, for example
https://example.com/sitemap.xml. - List folders or pages to block, one per line, such as
/wp-admin/or/cart/. - Add exceptions if a file inside a blocked folder must stay open, like
/wp-admin/admin-ajax.php. - Optionally set rules for individual bots.
- Click Download robots.txt and upload the file to the root folder of your site.
Important: robots.txt does not hide pages
This is the most common misunderstanding. Blocking a page in robots.txt stops crawling, not indexing. If other sites link to a blocked page, Google can still list its URL without a description. To keep a page out of search results, let Google crawl it and add a noindex robots meta tag instead, which you can create with our Meta Tag Generator.
Also, robots.txt is public. Anyone can read it, so never list secret folders there. Protect private areas with a password.
Google's introduction to robots.txt covers the rules in detail.
Robots.txt mistakes to avoid
Disallow: /underUser-agent: *blocks your entire site. It is often left behind after a website goes live.- Blocking CSS and JavaScript files can stop Google from rendering your pages properly.
- Paths are case-sensitive:
/Blog/and/blog/are different.
After uploading, run a Website SEO Audit, which confirms that robots.txt and sitemap.xml are reachable. If you do not have a sitemap yet, build one with the XML Sitemap Generator.
Robots.txt syntax explained
A robots.txt file is a plain text file made of groups. Each group starts with a User-agent line, followed by rules:
| Directive | Meaning | Example |
|---|---|---|
User-agent | Which bot the rules apply to. * means all bots. | User-agent: Googlebot |
Disallow | A path the bot should not crawl | Disallow: /admin/ |
Allow | An exception inside a blocked folder | Allow: /admin/help.html |
Sitemap | The full URL of your XML sitemap | Sitemap: https://example.com/sitemap.xml |
Crawl-delay | Seconds to wait between requests (ignored by Google) | Crawl-delay: 10 |
Paths are case sensitive and start from the root of the domain. An empty Disallow: line means nothing is blocked. Google's robots.txt specification is the official reference.
Ready-made examples
Allow everything (most small sites):
``` User-agent: * Disallow:
Sitemap: https://example.com/sitemap.xml ```
Typical WordPress site:
``` User-agent: * Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php
Sitemap: https://example.com/sitemap_index.xml ```
Block one folder for all bots:
`` User-agent: * Disallow: /private-files/ ``
Should you block AI crawlers?
Several AI companies publish the names of their crawlers so site owners can opt out, for example GPTBot (OpenAI), Google-Extended (Google's AI training control), CCBot (Common Crawl) and ClaudeBot (Anthropic). Blocking them may keep your content out of some AI training data, but it may also mean your brand appears less in AI answers. There is no single right answer; decide based on whether you want visibility or control. This generator has one-click options for GPTBot, Google-Extended and CCBot.
Testing your robots.txt
After uploading the file to the root of your domain, open https://yourdomain.com/robots.txt in a browser to confirm it is live. Then use the robots.txt report in Google Search Console to see which version Google fetched and whether it found errors. If a page is unexpectedly missing from Google, check it with the Meta Tag Checker as well, because a noindex tag is a more common cause than robots.txt.
Always pair your robots.txt with a good sitemap. If you do not have one yet, create it with the XML Sitemap Generator and add its URL to the Sitemap: line.
Example: a small business website
A typical small business site with a contact form and a private admin area might use:
``` User-agent: * Disallow: /admin/ Disallow: /thank-you/
Sitemap: https://example.com/sitemap.xml ```
This lets every search engine crawl the public pages, keeps the admin area and the form confirmation page out of crawling, and points bots to the sitemap. Remember that the thank-you page should also carry a noindex tag if you do not want it in search results.
Quick robots.txt checklist
- The file is called
robots.txt, in lower case, at the root of the domain. - It is plain text, saved as UTF-8.
- Each subdomain has its own file if needed, for example
shop.example.com/robots.txt. - CSS, JavaScript and image folders are not blocked.
- The Sitemap line uses the full https address.
- After changes, the file was tested in Google Search Console's robots.txt report.
Frequently Asked Questions
Where do I upload robots.txt?
To the root folder of your domain, so it opens at yourdomain.com/robots.txt. It will not work inside a subfolder.
Should I block AI bots?
It is your choice. Blocking GPTBot or Google-Extended stops those bots from using your content for AI training. It does not affect normal Google search rankings.
Do I need a robots.txt file at all?
It is not required, but it is recommended so you can point bots to your sitemap.
Does every bot obey robots.txt?
Reputable search engines do. Bad bots may ignore it.
Can robots.txt remove a page from Google?
No. It only stops crawling. To remove a page, allow crawling and add a noindex meta tag, or delete the page so it returns 404 or 410.
Should I block CSS and JavaScript files?
No. Google needs them to render your page properly. Blocking them can make Google think the page is broken on mobile.
Is robots.txt a security feature?
No. The file is public and anyone can read it. Protect private areas with a password, not with robots.txt.
Last updated: October 25, 2026