How to Create robots.txt: Step-by-Step Beginner Guide
Alisha Anjum
Introduction
To create a robots.txt file from scratch, open a plain text editor, write a few crawl rules, save the file as robots.txt, upload it to the root of your domain, and test it with a robots.txt checker. Once you understand how to set up robots.txt, search engines can crawl your website with far less risk.
That small text file controls which pages Google, Bing, Yandex, and other crawlers visit, so mistakes in it can quietly damage search traffic.
This guide explains robots.txt basics, walks through setup step by step, shows clear examples, and introduces the Tools Repository Robots.txt Generator. Read on so you can avoid common crawler traps.
Here is a quick look at the generator fields you will use once you reach the tool: an allow/disallow toggle for each bot, a crawl-delay field, and a sitemap URL field.
Keep these fields in mind as you read through the syntax and setup steps below. The Tools Repository Robots.txt Generator uses the same inputs to build your file.
Key Takeaways

A robots.txt file tells search bots which pages and folders they can visit. It sits in your domain root. Clear rules protect crawl budget and reduce messy indexation.
The file must be named
robots.txtand placed atmysite.com/robots.txt. Directives like User-agent, Disallow, Allow, and Sitemap guide each crawler. Simple syntax helps you avoid painful mistakes.Always view your file in a browser and test rules with Google Search Console before launch. Regular checks catch tiny errors. The Tools Repository Robots.txt Generator builds safe files in seconds.
What Is a Robots.txt File and Why Does It Matter for SEO?
A robots.txt file is a small text file at your site root that tells search engines where they may crawl. It matters for SEO because these rules shape how Google, Bing, and other bots discover, load, and judge your content.
Robots.txt sits at the top level of your domain, at https://yourdomain.com/robots.txt, and it controls crawling for that host only, a dynamic that Market or Markets? Investigating Google’s search structure helps put into broader competitive context. When Googlebot first visits a site, it requests this file before any other URL, according to Google Search Central. If the file is missing, crawlers treat that as full access.
For SEO, robots.txt acts like a front gate. A clean robots.txt file lets bots spend more time on valuable pages and less on login areas, internal search pages, or endless filter URLs. That focus helps your important content appear in search more often. Research from Ahrefs shows that 90.63 percent of pages get no organic traffic from Google, and weak technical setup is one reason.
Robots.txt has clear limits though:
For true removal, you use a noindex tag on the page and allow crawling.
Here is a quick guide to picking the right method:
Robots.txt Syntax Rules and Core Directives Explained

Robots.txt syntax rules describe how you write instructions for crawlers, and the core directives define what each rule means. Once you understand this syntax, you can read or write almost any robots.txt file with confidence.
Each robots.txt file is made of groups. A group starts with a User-agent line and then one or more rules such as Disallow, Allow, and optional lines like Sitemap or Crawl-delay. Crawlers choose the most specific group that matches their name; for example, Googlebot prefers rules written for Googlebot over rules written for the wildcard *.
Here is a simple robots.txt file example:
The User-agent directive tells which bot a group targets. Common names include Googlebot, bingbot, slurp for Yahoo, yandex, and baiduspider. Wildcard * means all bots.
Beyond these general bots, you can also target crawlers individually when you need finer control over specific services:
Disallow marks paths that a bot must not crawl. When you write Disallow: /admin/ in a group, that crawler skips every URL that starts with that folder. An empty Disallow line means full access. Disallow: / is the well-known robots.txt disallow all rule, which blocks the entire site.
Allow lets you open a specific path inside a blocked folder. A classic WordPress pattern looks like this:
The Sitemap line shares your sitemap location, using a full URL. You can list several sitemaps if your site has many sections. Crawl-delay asks some bots to slow down between hits, though Google Search Central confirms that Google ignores it. Since first-position clicks matter a lot, and Backlinko reports that the top organic result gets about 31.7 percent of all Google clicks, these small syntax details can pay off.
AI crawler bots: GPTBot, OAI-SearchBot, CCBot, ClaudeBot, and more
Search bots are no longer the only visitors reading your robots.txt file. AI companies run their own crawlers to train models or power chat-based answers, and each one has a different job. Here is a quick guide to the main AI crawlers and whether you should allow or block them.
GPTBot is OpenAI’s crawler used to gather web content for training future models. If you don’t want your content used for AI model training, add a
Disallow: /rule under aUser-agent: GPTBotgroup. Many publishers block this bot while still allowing search bots.OAI-SearchBot is a separate OpenAI crawler, and it’s what indexes your pages for ChatGPT’s search feature. Blocking GPTBot does not block OAI-SearchBot, so treat them as two different decisions. If you want your pages to surface as answers inside ChatGPT search, leave OAI-SearchBot allowed.
ClaudeBot is Anthropic’s crawler, used to collect training data for the Claude family of models. As with GPTBot, you block it with its own
User-agentgroup if you don’t want your site used for training.CCBot belongs to Common Crawl, a nonprofit that publishes a large open web archive used by many researchers and AI labs. Blocking CCBot keeps your pages out of that archive, which in turn keeps them out of any model trained on it.
Google-Extended is a separate control from Googlebot. It governs whether Google can use your content for Gemini and other AI features, without affecting your normal Google Search ranking.
A simple pattern for blocking AI training crawlers while keeping normal search access looks like this:
User-agent: GPTBot
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: CCBot
Disallow: /
User-agent: *
Allow: /
There’s no single right answer here. Site owners who rely on search visibility usually keep Googlebot, bingbot, and OAI-SearchBot allowed, since those drive traffic back to the site. Owners who worry about their writing or code training outside models more often block GPTBot, ClaudeBot, and CCBot, while leaving everything else untouched.
How to Create and Deploy Your Robots.txt File Step by Step

This section shows how to create robots.txt from a blank file, place it in the correct spot, and test it. Follow these steps and you will set up a safe, working robots.txt file for your website.
Step 1: Create The File
Open a plain text editor such as Notepad, TextEdit in plain text mode, VS Code, or Sublime Text. Start a new blank file. Do not use a word processor, because it may add smart quotes or other hidden characters that confuse crawlers. Save the file asrobots.txtwith UTF-8 encoding on your computer.Step 2: Write Your Rules
List which folders and pages you want bots to skip, such as admin panels, login pages, and test areas. Decide which bots need special treatment; for example, you might want one group for Googlebot and another for all others. Then add lines for User-agent, Disallow, Allow, and Sitemap. Here is a tiny robots.txt file example you can adjust:Step 3: Upload To The Site Root
Your robots.txt file location must be the top level of the site, not a subfolder. Use cPanel File Manager, FTP, SFTP, or your cloud host dashboard to upload the file into the main web root, often namedpublic_htmlorwww, keeping in mind that research on Behavioral Factors Influencing Local SEO strategy shows proper file placement is a foundational technical signal. When you visithttps://yourdomain.com/robots.txt, the file content should appear as plain text. For subdomains, such asblog.example.com, you upload a separate file to that subdomain root.Step 4: Verify Public Access
Open a private or incognito browser window so you are not seeing a cached version. Visit your exact robots.txt URL and confirm that every line looks right. Check that there are no stray characters, fancy quotes, or unwanted spaces. If you just added robots.txt to a website for the first time, this simple check catches most early mistakes.Step 5: Test And Monitor
Use the robots.txt report inside Google Search Console to see how Googlebot reads your file and which URLs are blocked. That report acts as a handy robots.txt checker, since you can paste sample URLs and see whether they are allowed. You can also test complex files with Google’s open source robots parser before upload. Rerun these checks whenever you update your rules so you do not break crawling by accident.
Tip: A single line that reads
User-agent: *andDisallow: /creates robots.txt disallow all behavior, which blocks every crawler from your site. Always test for that pattern before publishing changes.
Ready-made robots.txt templates for WordPress, Shopify, and Wix
Most popular platforms generate a basic robots.txt automatically, but you often need to add a few lines of your own. Here are starter templates for the three platforms readers ask about most, along with where to find and edit the file on each.
WordPress creates a virtual robots.txt file by default, and you don’t see it as an actual file in your hosting account. To edit it, use an SEO plugin such as Yoast SEO or Rank Math, both of which add a robots.txt editor under their settings menu, or upload a physical file to your site root through FTP to override the virtual one. A common WordPress starter file looks like this:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Disallow: /wp-includes/
Sitemap: https://yourdomain.com/sitemap.xml
Shopify generates its own robots.txt automatically and does not let you upload a replacement file. Instead, you add exceptions through a robots.txt.liquid theme template in your Shopify admin, under Online Store, Themes, Edit Code. A typical addition inside that template looks like this:
{% if group.rules.size > 0 %}
{%- for rule in group.rules -%}
{{ rule.directive }}: {{ rule.value }}
{%- endfor -%}
{% endif %}
Sitemap: https://yourstore.myshopify.com/sitemap.xml
Wix also builds a default robots.txt for every site, and you manage changes through the SEO Tools section of your Wix dashboard, under Marketing & SEO, SEO Tools, rather than by uploading a file directly. Wix lets you add custom directives on top of the default file, so a simple custom addition might look like this:
User-agent: *
Disallow: /_api/
Disallow: /checkout
Sitemap: https://yourdomain.com/sitemap.xml
Whichever platform you use, paste the output into the Tools Repository Robots.txt Generator first to check the syntax, then apply it through the platform’s own editor rather than searching for a hidden file path that may not exist on hosted platforms.
How to Generate a Robots.txt File Instantly With Tools Repository

This section explains how to generate a robots.txt file quickly with Tools Repository instead of writing syntax by hand. The idea is simple, and it can save you from copy‑paste errors.
The Tools Repository Robots.txt Generator at toolsrepository.com is a free, browser-based robots.txt generator tool. You enter basic settings, such as which crawlers to allow, which folders to hide, whether to add crawl delay, and your sitemap URL. While you type, the tool builds a clean robots.txt preview in real time that you can copy straight into your file.
Everything in Tools Repository runs in your browser, so website details never leave your machine, an important consideration given that An Open Letter to SEO tool vendors highlights growing concerns about how tools handle sensitive site data. That privacy-first design helps freelance developers, agencies, and students who work with confidential projects. Site owners also like that the generator output follows common robots.txt rules explained in this guide, which makes it easy to understand and adjust later.
Tools Repository keeps the Robots.txt Generator one hundred percent free, with no paid tiers or feature locks. Freelancers, hobby site owners, and large teams all get the same version. You do not create an account and you do not see signup walls, which keeps the workflow smooth.
The generator is fully client-side and stores nothing on Tools Repository servers. You can safely add internal paths or staging URLs while testing your robots.txt file, because the data stays inside your browser tab. That fits well with teams that care deeply about security and privacy.
The interface works nicely on phones, tablets, and desktops. Alongside the generator, Tools Repository also offers a Meta Tag Generator and over one hundred other tools for SEO, code formatting, and data conversion, all inside a single clean dashboard.
Critical Robots.txt Mistakes to Avoid and SEO Best Practices

This section highlights the biggest robots.txt mistakes to avoid and shares robots.txt best practices you can follow every time. Treat it as a short robots.txt SEO tutorial to review before editing your file.
Common mistakes include:
Blocking CSS or JavaScript folders. Google now renders pages with a headless Chrome engine, and Google Search Central warns that blocked resources can lead to poor rendering and weaker rankings.
Using robots.txt as a security shield, even for areas like admin panels or private reports. Since the file is public and bad bots often ignore it, you always pair it with real authentication, a finding reinforced by evidence that Scrapers selectively respect robots.txt directives, meaning malicious crawlers frequently bypass these rules entirely.
Confusing crawling and indexing. When you block a URL path, Google may still index that address if other sites link to it, although the result will show little detail, a nuance that Artifact: Odyssey of robots.txt governance research examines closely in the context of LLM web crawling compliance.
Forgetting to retest files after quick edits. This is how accidental global blocks such as
Disallow: /end up on live servers. According to Internet Live Stats, Google processes billions of searches every day, so even short outages can cost real traffic.
Tip: Before changing robots.txt on a live site, keep a copy of the previous version. If something goes wrong, you can restore the old file in seconds.
Robots.txt best practices are simple:
Block only low-value areas such as admin pages, internal search results, and endless filter combinations. Let crawlers reach normal content, CSS, and JavaScript so they can see pages the way users see them.
Always include a Sitemap line that points to your XML sitemap, because that helps bots find your main pages quickly. Keep rules short and clear, and avoid clever patterns that are hard to debug later.
After each change, view the file in a browser and retest it inside Google Search Console. Save a backup of the previous version so you can roll back fast if a problem appears.
Wrapping Up
A well written robots.txt file gives search engines a clear path through your site while keeping them out of cluttered or sensitive areas. You now know what the file does, how its syntax works, how to create robots.txt step by step, and how to avoid the most damaging mistakes.
When you want a ready-to-use file in seconds, the Tools Repository Robots.txt Generator offers a fast, free, and private shortcut. Open it, set a few options, copy the output, and your next robots.txt update is ready to publish.
Frequently Asked Questions
Question 1: Where Exactly Should The Robots.txt File Be Located On My Website?
The robots.txt file must live at the root of your site, such as https://yourdomain.com/robots.txt. It cannot sit in a subfolder. The rules there apply only to that exact protocol, host, and port, so each subdomain needs its own file.
Question 2: Does Robots.txt Affect My Website’s Google Rankings?
Robots.txt affects rankings indirectly. If it blocks key pages or resources like CSS and JavaScript, Google cannot crawl or render them well, which may lower visibility. Smart rules that hide only low-value pages can protect crawl budget, but the file alone does not push rankings upward.
Question 3: Can I Have More Than One Robots.txt File On My Site?
You can have only one robots.txt file per host, which means one file for each protocol, domain, and port combination. However, separate subdomains such as shop.example.com and blog.example.com each need their own robots.txt file at their own root.
Question 4: How Do I Block Only One Specific Search Engine Bot?
To block a single crawler, create a group that names that bot in the User-agent line and add Disallow rules under it. For example, you might have one group for bingbot and leave another group for all other crawlers untouched so they keep normal access.
Question 5: How Often Do Search Engines Re-Read My Robots.txt File?
Search engines cache robots.txt and re-read it several times per day, especially on active sites. When you make an urgent change, you can ask Google to fetch the file again through Google Search Console so new rules apply more quickly.