ForHosting KIT · Web Scraping & Monitoring

Generate robots.txt from crawler rules and a sitemap URL

This robots.txt generator converts structured crawler instructions into clean, ready-to-publish file content.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Add each user-agent, choose whether its path is allowed or disallowed, and provide the absolute URL of your XML sitemap. The generator validates every path, groups rules for the same crawler, uses canonical directive spelling, and returns deterministic plain text with safe line breaks. It is useful for drafting a new policy, replacing an error-prone hand-written file, or producing consistent robots.txt content inside a deployment pipeline.

Describe crawler access as explicit rules

Start by adding one row for every crawler and path decision. A user-agent identifies the crawler that should receive the instruction; use an asterisk when a rule applies to all crawlers, or supply a specific crawler token when its treatment differs. Then select Allow or Disallow and enter the relevant path pattern. Every path must begin with a forward slash, including the root path itself. This requirement catches a common robots.txt mistake before the file is published. Rules belonging to the same user-agent are collected into one group even when their rows are separated in the input, while both group order and rule order follow their first appearance. That stable ordering makes the result easy to review in a pull request and prevents needless changes between repeated builds. The generator does not decide which areas should be private or crawlable; it faithfully serializes the policy you provide, so review the paths against the actual routing structure of your site.

Understand what the generated file controls

A robots.txt file gives cooperative web crawlers instructions about which URL paths they may request. It is not an authentication system, an access-control list, or a way to conceal confidential material. A disallowed address may still be discovered through links, and clients that ignore the protocol can request it unless the server enforces separate authorization. Use application permissions, private storage, or server rules for anything that must remain protected. Within a user-agent group, specific crawlers interpret Allow and Disallow patterns according to their own documented matching behavior, especially when wildcards or end markers are involved. This tool preserves path text rather than attempting to predict a particular crawler’s precedence rules. It rejects embedded line breaks in user-agent names, directives, paths, and the sitemap value so one field cannot silently inject extra records. The result uses conventional capitalization and blank lines, creating readable syntax without adding comments or assumptions that were not present in the structured input.

Publish the result and verify it in context

Place the returned content in a plain-text file named robots.txt at the root of the relevant website origin, such as https://example.com/robots.txt. The sitemap field must be an absolute HTTP or HTTPS URL, and the generator normalizes that URL before adding a final Sitemap line. This declaration helps crawlers locate the XML sitemap even when it is hosted at a less obvious path or on another permitted host. After deployment, request the public robots.txt URL directly and confirm that the response is successful, has plain-text content, and is not replaced by an application error page, redirect loop, or login screen. Test important paths with the inspection tools supplied by the search engines and crawlers you care about, because crawler support and matching details can differ. Regenerate the file whenever routes, private sections, staging protections, or sitemap locations change. The output is deterministic for the same input, making it suitable for source control, automated builds, configuration reviews, and repeatable infrastructure deployments.

Launch a new website

Create a readable crawler policy and sitemap declaration before the production domain is opened for indexing.

Standardize deployment configuration

Generate identical robots.txt content from structured settings across repeatable site builds.

Separate crawler policies

Group general rules and crawler-specific exceptions without manually rearranging text blocks.

What happens when a rule path does not start with a slash?

The request fails with an invalid input error identifying the rule, and no file content is generated.

Can I add rules for more than one user-agent?

Yes. Rules are grouped by user-agent in the order each user-agent first appears.

Does Disallow protect private information?

No. Robots.txt is guidance for cooperative crawlers, not security. Protect sensitive resources with server-side authorization.

Where should I publish the generated content?

Publish it as robots.txt at the root of the website origin whose crawling policy it describes.

Which sitemap URLs are accepted?

The sitemap must be a valid absolute URL using HTTP or HTTPS.

What does the API cost?

The API costs $0.002 per request. The browser version is available free on this page.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/web/robots-txt-generate

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/web/robots-txt-generate \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rules":[{"user_agent":"*","directive":"allow","path":"/"},{"user_agent":"*","directive":"disallow","path":"/private/"},{"user_agent":"ResearchBot","directive":"disallow","path":"/"}],"sitemap_url":"https://example.com/sitemap.xml"}'
{
  "rules": [
    {
      "user_agent": "*",
      "directive": "allow",
      "path": "/"
    },
    {
      "user_agent": "*",
      "directive": "disallow",
      "path": "/private/"
    },
    {
      "user_agent": "ResearchBot",
      "directive": "disallow",
      "path": "/"
    }
  ],
  "sitemap_url": "https://example.com/sitemap.xml"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "web.robots_txt_generate",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

timeout_sec30
max_crawl_pages25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →