Run a free audit

Robots.txt generator

Build a valid robots.txt with allow/disallow rules, crawl-delay and sitemap lines. Then test it with the robots.txt tester.

robots.txt

User-agent: *
Allow: /

Sitemap: https://example.com/sitemap.xml
Auditing the whole site? Run a full audit
  1. Home
  2. /
  3. Free tools
  4. /
  5. Robots.txt generator

A robots.txt generator creates a plain-text file that tells crawlers which parts of your website they can access. You specify user-agent rules, disallow or allow specific paths, set an optional crawl-delay, and add your sitemap URL; the tool outputs the correctly formatted file you deploy to your root directory.

On this page

  • What Robots.txt Does and Why It Matters
  • How to Use This Robots.txt Generator
  • Robots.txt Syntax Rules You Must Follow
  • How Allow and Disallow Directives Work Together
  • Common Mistakes That Break Your Robots.txt
  • Testing, Deploying, and Maintaining Your File
  • When and How to Use Crawl-Delay and Sitemaps

What Robots.txt Does and Why It Matters

A robots.txt file is a plain-text file that communicates with search engine crawlers and other bots visiting your website. It lives at the root of your domain (example.com/robots.txt) and contains instructions about which content crawlers can access. Search engines like Google, Bing, and others read this file before crawling your site to understand your rules.

When a crawler arrives at your website, it first checks for robots.txt at the root domain. If the file exists and returns a 200 HTTP status code, the crawler reads the directives. If it returns a 404 or is unreachable, crawlers typically assume they can crawl everything unless other blocking mechanisms like meta tags are in place.

Without robots.txt, you have no way to communicate crawl preferences to bots. Every website has a limited crawl budget—the number of pages a search engine will crawl in a given period. If crawlers waste budget on duplicate pages, admin interfaces, or low-value content, they may miss important pages you want indexed. A properly configured robots.txt helps direct crawlers to your most valuable content.

Common reasons to use robots.txt include blocking access to admin pages, login areas, search results pages that create duplicate content, staging environments, private user data, or temporary directories. You also use it to point crawlers to your XML sitemap, which helps search engines discover your important pages more efficiently.

How to Use This Robots.txt Generator

This generator works by accepting your crawl preferences as form inputs, then outputting a correctly formatted robots.txt file. You type the rules you want, and the tool ensures they follow correct syntax so search engines interpret them properly.

  1. 1Choose a user-agent. This specifies which bot the rule applies to. You can target specific bots like Googlebot or Bingbot, or use an asterisk (*) to create a rule that applies to all bots except where you've already specified a different bot in a more specific rule.
  2. 2Add paths to disallow. Enter the website paths or directories you want to block from crawling, one per line. For example, /admin, /private, or /search-results. Include the leading forward slash.
  3. 3Add paths to allow (optional). If you've blocked a broad directory with Disallow, you can use Allow to permit access to specific pages or subdirectories within it. For example, allow /private/public-docs while disallowing /private overall.
  4. 4Set crawl-delay (optional). If you want to slow down crawlers to reduce server load, specify a delay in seconds between requests. For example, a value of 2 means crawlers wait 2 seconds between requests to your site.
  5. 5Add your sitemap URL. Enter the full URL to your XML sitemap (for example, https://example.com/sitemap.xml). This helps crawlers find and prioritize your important pages.
  6. 6Generate your file. Click the button to create the robots.txt file with your specifications.
  7. 7Copy or download. The tool displays your robots.txt file. You can copy the text and paste it into a file, or download it directly. Upload this file to your website's root directory.

The generator produces a plain-text file with no special formatting. You upload it exactly as generated—no modifications needed unless you want to add additional rules later.

Robots.txt Syntax Rules You Must Follow

Robots.txt files have strict syntax requirements. Crawlers will misinterpret or ignore lines that don't follow the rules, so your file won't work as intended. Understanding these rules helps you avoid common mistakes.

  • File encoding must be UTF-8. Non-UTF-8 characters outside the ASCII range may be ignored by crawlers, breaking your directives.
  • Each directive goes on its own line. You cannot combine multiple directives on a single line.
  • Each User-agent group must start with a User-agent line. This declares which bots the following Allow and Disallow lines apply to.
  • Paths must start with a forward slash (/). For example, /admin, not admin. The path is relative to your root domain.
  • Directories should end with a forward slash. Use /images/ to block a directory or /images/file.jpg to block a specific file.
  • Robots.txt is case-sensitive. /Admin is different from /admin. Paths must match exactly.
  • Comments start with a hash symbol (#). Everything after # on a line is ignored.
  • Do not use quotation marks, semicolons, or spaces at the beginning of lines. These will cause parsing errors.
  • Wildcards (*) match any number of characters within a path. For example, /temp* matches /temp, /temporary, and /template. Wildcards cannot match across directory levels.

File name and location matter. The file must be named exactly robots.txt (lowercase, no spaces). It must be placed in the root directory of your domain. For https://www.example.com, the URL must be https://www.example.com/robots.txt. You cannot place it in a subdirectory or on a subdomain and expect it to control the main domain.

How Allow and Disallow Directives Work Together

The Allow and Disallow directives work together to create your crawl rules, but they have a specific relationship. Understanding how they interact prevents accidental mistakes that leave parts of your site exposed or blocked.

Disallow tells a crawler it cannot access a path. Disallow: /admin means crawlers cannot access anything under the /admin directory or any files matching that path pattern. By default, if you don't specify a Disallow for a path, crawlers assume it's allowed.

Allow overrides a broader Disallow. If you write Disallow: /private followed by Allow: /private/public, crawlers will block /private but allow /private/public. This is useful when you need to block most of a directory but permit specific exceptions. The most specific rule wins—a longer, more specific path takes precedence over a shorter, broader one.

Query strings and fragments are not blocked by robots.txt. If you disallow /search, a crawler can still access /search?query=example because the query string comes after the path. If you want to block pages based on query parameters, use a different method like meta robots tags or noindex headers.

The order of rules matters for multiple User-agent groups. Crawlers read from top to bottom and use the first matching group. If you have rules for Googlebot and then rules for all bots (*), Googlebot stops at the first matching group and doesn't continue to the catch-all group.

An empty Disallow (Disallow: with no path) means crawlers can access everything. This is the default behavior even if you don't include the line at all.

Common Mistakes That Break Your Robots.txt

Even small mistakes in robots.txt can have large consequences. These are the most common errors that undermine your crawl control.

  • Blocking the entire site with Disallow: /. This prevents all crawlers from accessing your website, which removes it from search results. Never use this unless you specifically want the site hidden from search engines.
  • Blocking CSS, JavaScript, or image files. If crawlers cannot fetch these resources, search engines cannot fully render your pages. Some crawlers need these files to evaluate page quality. Only block them if you have a specific reason.
  • Forgetting the leading slash. Disallow: admin is interpreted differently than Disallow: /admin. Crawlers expect paths to start with /, so your rule may not work as intended.
  • Incorrect case in paths. Disallow: /Admin will not block /admin because robots.txt is case-sensitive. If your actual directory is /admin (lowercase), you must use lowercase in the file.
  • Including quotes, spaces, or semicolons. Disallow: '/admin' or Disallow: /admin; will cause parsing errors. Use only the directive, colon, space, and path.
  • Placing the file in the wrong directory. A robots.txt in /public/robots.txt will not control the site. It must be at /robots.txt (the root).
  • Accidentally blocking your homepage. Some configurations can unintentionally block /, your homepage. Test to ensure this is accessible.
  • Using regex patterns instead of wildcards. Robots.txt uses wildcard syntax (*), not regex. An expression like /page[0-9]+ will not work as a regex; it will be treated literally.

Testing, Deploying, and Maintaining Your File

After generating your robots.txt file, deployment and testing are critical. A file that isn't reachable or contains syntax errors won't protect your site or guide crawlers.

  1. 1Upload the file to your root directory. Use your hosting provider's file manager, FTP, or command line to place the robots.txt file in the root. For https://example.com, it should be accessible at https://example.com/robots.txt.
  2. 2Verify it's publicly accessible. Open a browser and navigate to yourdomain.com/robots.txt. You should see the file contents displayed. If you see a 404 error or a login page, the file is not in the right location.
  3. 3Check the HTTP status. The file should return a 200 OK response. If it returns 404, 403, or 503, search engines cannot read it.
  4. 4Test with Google Search Console. In Google Search Console, go to Settings > Crawl and select robots.txt tester. Paste your robots.txt contents or let it fetch your live file. Test specific URLs to see whether they're allowed or blocked according to your rules.
  5. 5Monitor Crawl Stats in Search Console. After deployment, check whether the crawl budget and crawl requests match your expectations. If crawlers are still accessing blocked pages, you may have a syntax error.
  6. 6Update your file when your site changes. If you reorganize directories, add new admin paths, or change crawl preferences, update robots.txt accordingly. You can regenerate it using this tool and re-upload.
  7. 7Keep a backup of your current rules. If you make changes, keep the previous version in case you need to revert.

Robots.txt changes take effect immediately once uploaded, but crawlers may not re-fetch the file for several hours. If you urgently need to block something, use a meta robots tag or X-Robots-Tag HTTP header as a supplementary measure.

When and How to Use Crawl-Delay and Sitemaps

The crawl-delay directive and sitemap URLs are optional but powerful tools for fine-tuning how search engines interact with your site.

Crawl-delay specifies the minimum number of seconds a crawler should wait between requests to your site. A crawl-delay of 2 means the crawler waits at least 2 seconds after fetching one page before requesting the next. This reduces server load during crawling. Use crawl-delay if your server has limited resources and crawlers cause noticeable slowdowns. However, crawl-delay can also slow down how quickly search engines discover new content, so use it conservatively. Most sites do not need a crawl-delay; instead, use server-side rate limiting or contact your hosting provider about crawler traffic.

The Sitemap directive points crawlers to your XML sitemap file. A sitemap is a list of all your important pages that you want indexed. By providing the URL to your sitemap in robots.txt, you make it easy for crawlers to find all your content without following links across the site. You can list multiple sitemaps. For example, if you have separate sitemaps for blog posts, products, and images, you can add all of them. Always use the full URL, including the protocol (https://).

Sitemaps are one of the most valuable additions to robots.txt. Even if you use Allow and Disallow to control crawling, a sitemap ensures that crawlers discover all your important pages and understand your site structure. Most CMS platforms like WordPress generate sitemaps automatically, usually at /sitemap.xml.

Frequently asked questions

What is a robots.txt file?+

A robots.txt file is a plain-text file placed in the root of your website that contains instructions for search engine crawlers and bots. It specifies which parts of your site they can and cannot access. For example, you might block crawlers from accessing your admin pages, login areas, or duplicate content. The file must be named exactly robots.txt and placed at yourdomain.com/robots.txt.

Why do I need a robots.txt file?+

Robots.txt helps you manage your crawl budget by directing search engine crawlers to your most important content and away from low-value pages like admin sections, duplicates, or staging sites. This ensures crawlers spend their resources on pages you want indexed. It also helps you keep private or sensitive pages out of search results and prevents duplicate content from diluting your SEO value.

Is this robots.txt generator free?+

Yes, this generator is completely free. You can create, edit, and download as many robots.txt files as you need without paying or signing up for an account.

Can I update my robots.txt file later?+

Yes. Robots.txt is a simple text file, so you can edit it directly on your server using an FTP client, file manager, or command line at any time. You can also use this generator to create an updated version and re-upload it. Changes take effect immediately, though crawlers may take several hours to fetch the new version.

What is the difference between Allow and Disallow in robots.txt?+

Disallow tells crawlers they cannot access a specific path or directory. Allow overrides a broader Disallow to permit access to specific exceptions. For example, you might use Disallow: /private to block a directory, then Allow: /private/public-files to permit access to one subdirectory within it. The most specific rule takes precedence.

How do I add a sitemap to my robots.txt file?+

Add a Sitemap directive with the full URL to your XML sitemap file. For example: Sitemap: https://example.com/sitemap.xml. You can list multiple sitemaps if you have separate ones for different content types (blog posts, products, images, etc.). The URL must include the protocol (https:// or http://).

What crawl-delay value should I use?+

Use crawl-delay only if your server experiences noticeable slowdowns from crawler traffic. A value of 1 or 2 seconds is typical. However, crawl-delay can slow down indexing, so consider server-side rate limiting or contacting your host instead. Most websites do not need crawl-delay. Google may also ignore this directive in favor of settings in Google Search Console.

Related free tools

On-page SEO scorerOn-page meta checkerWebsite speed testMobile-friendly test

On this page

  • What Robots.txt Does and Why It Matters
  • How to Use This Robots.txt Generator
  • Robots.txt Syntax Rules You Must Follow
  • How Allow and Disallow Directives Work Together
  • Common Mistakes That Break Your Robots.txt
  • Testing, Deploying, and Maintaining Your File
  • When and How to Use Crawl-Delay and Sitemaps