What is robots.txt?
robots.txt is a small text file at the root of a website, for example https://example.com/robots.txt. Search engine crawlers such as Googlebot and Bingbot read it before they crawl your site. It tells them which areas they may visit and where your sitemap is. A correct file keeps crawlers away from pages that should not appear in search, such as admin areas, shopping carts and internal search results, and helps them focus on your important content.
How to create your robots.txt
- Keep Allow everything for a normal live website.
- List folders or pages crawlers should skip, one per line, each starting with
/. - Add the full URL of your XML sitemap.
- Optionally block AI crawlers that collect content to train AI models.
- Download the file and upload it to the main (root) folder of your website, so it opens at
yourdomain.com/robots.txt.
robots.txt syntax
| Line | Meaning |
|---|---|
User-agent: * | The rules below apply to all crawlers |
Disallow: /admin/ | Do not crawl anything inside /admin/ |
Disallow: (empty) | Nothing is blocked |
Allow: /admin/help.html | Exception inside a blocked folder |
Disallow: /*.pdf$ | Block all URLs ending in .pdf (* = anything, $ = end) |
Sitemap: https://…/sitemap.xml | Where to find your sitemap |
Important limits of robots.txt
- It is not security. The file is public and polite crawlers follow it, but bad bots ignore it. Protect private areas with passwords.
- It does not remove pages from Google. A blocked page can still appear in results if other sites link to it. To keep a page out of search, allow crawling and add a
noindexmeta tag. - Do not block CSS and JavaScript files. Google needs them to see your pages correctly.
- Never leave
Disallow: /on a live site; it is a common reason for sites disappearing from search after a redesign.
Frequently asked questions
Will blocking GPTBot affect my Google ranking?
No. GPTBot and Google-Extended are separate from Googlebot, which handles search.
How do I test my robots.txt?
Use the robots.txt report in Google Search Console after uploading.
Do I also need a sitemap?
Yes, especially for new sites. Create one with our XML Sitemap Generator.