Short definition

robots.txt — a text file in the root of a website that tells search engine and AI crawlers which paths they may and may not fetch.

Also known as: robots txt, robots.txt file.

robots.txt is a text file in the root of your website that tells crawlers which paths they may and may not fetch. It controls crawling, not the index: a page you block can still appear in Google. To keep a page out of search results, you need noindex, and that only works if Google is allowed to crawl the page.

What is robots.txt for?

Search engines and other services send crawlers to your site: programs that fetch and read pages. A well-behaved crawler checks /robots.txt first and follows the rules it finds there. According to Google’s introduction to robots.txt, the file is mainly there to manage crawler traffic: to avoid overloading your server and to keep crawlers from wasting time on unimportant or near-duplicate pages, such as internal search results or filter combinations in an online store.

Since 2022, the rules have been an internet standard in RFC 9309, the Robots Exclusion Protocol. The standard also states what the file is not: the rules are not a form of access authorization.

What robots.txt does not do

  • It does not secure anything. Anyone can read your robots.txt, and a crawler that ignores the rules fetches the pages anyway. Put sensitive files behind a password.
  • It does not remove pages from Google. A blocked URL can stay in search results if other pages link to it, just without a description. Use noindex or remove the page instead.
  • It does not work together with noindex on the same page. If you block a page in robots.txt, Google never reads the noindex rule on that page. To get a page out of Google, keep it crawlable and add noindex.
  • It does not control link value. Whether a link counts as an endorsement is set on the link itself with nofollow, not in robots.txt.

What does a robots.txt file look like?

The file is made up of groups of rules. Each group starts with a User-agent line that says which crawler the group applies to, followed by Disallow and Allow lines with paths. An asterisk (*) means all crawlers. Anything not blocked is allowed. This is the file on straffesites.com:

User-agent: *
Allow: /
Disallow: /offerte/

Sitemap: https://straffesites.com/sitemap-index.xml

All crawlers may fetch the whole site, except the /offerte/ folder. That is where client proposals live that do not belong in search engines. Those pages also carry a noindex tag, but because of the Disallow rule, Google does not read it. That is the limitation from the previous section: if you need to be sure a page never shows up in Google, a password is the safe choice. The last line points to the sitemap: the full address of the file that lists every page we do want found.

A few details matter. Paths are case-sensitive: Disallow: /Offerte/ does not block /offerte/. The file must be named robots.txt and sit in the root. A crawler that finds a group with its own name follows only that group and ignores the rules under User-agent: *.

robots.txt and AI crawlers

robots.txt is also where you choose which AI services may fetch your content. You address their crawler by the name the provider publishes:

  • GPTBot fetches content for training OpenAI’s AI models, according to OpenAI’s crawler page.
  • OAI-SearchBot is what OpenAI uses to show sites in ChatGPT search results. If you block it, your site does not appear in ChatGPT search answers.
  • Google-Extended is not a separate crawler, according to Google’s list of crawlers. It is a name that controls whether Google may use your content for Gemini. It has no effect on your place in Google Search.

If you do not want your content used for training but do want to appear in ChatGPT search results, you could write:

User-agent: GPTBot
Disallow: /

User-agent: OAI-SearchBot
Allow: /

Two caveats. Here too, robots.txt is a request: the large providers say they follow it, but you cannot enforce it. And OpenAI notes that the rules may not apply to ChatGPT-User, because a user starts those visits.

Common mistakes

  • A test-site rule that ships to the live site. A test environment often gets Disallow: / so search engines ignore it. If that file goes live at launch, you block your entire site. Check /robots.txt after every launch.
  • Blocking CSS and JavaScript. Google needs those files to understand your pages. Only block them if the page does not change without them.
  • Using robots.txt to remove pages from the index. That does not work reliably, as explained above. Use noindex and keep the page crawlable.
  • Using a word processor. It can add curly quotes or a different format. Create the file in a text editor and save it as UTF-8.

To see how Google reads your file, open the robots.txt report in Search Console. It shows which version Google fetched last and whether it contains errors.

How it relates to other terms

robots.txt sets where crawlers may go. An XML sitemap does the opposite: it lists the pages you want found, and the Sitemap: line in robots.txt points to it. An llms.txt file does not control access, but gives AI agents a short overview of your most important pages. If the same content lives at several addresses, do not block the duplicates in robots.txt: a canonical URL marks the preferred version, and Google can still see the duplicates.

Not sure whether your robots.txt, sitemap, and indexing line up? That is a standard part of our SEO services for small businesses.