HomeSEO ToolsRobots & Sitemap
🤖 Web Crawler Generator

Robots.txt & XML Sitemap Generator

Generate production-ready robots.txt and XML sitemap configuration files for search bots.

Lastmod, changefreq, and priority apply to every URL in the list. Google ignores changefreq and priority, so leave them unset unless another search engine needs them.

robots.txt
User-agent: *
Allow: /
Disallow: /admin/
Disallow: /private/

Sitemap: https://smarttoolpack.com/sitemap.xml
sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://smarttoolpack.com/</loc>
  </url>
  <url>
    <loc>https://smarttoolpack.com/about/</loc>
  </url>
  <url>
    <loc>https://smarttoolpack.com/contact/</loc>
  </url>
</urlset>

How crawlers read robots.txt

The Robots Exclusion Protocol was used informally from 1994 and standardised as RFC 9309 in 2022. A crawler fetches /robots.txt from the root of a host before crawling it, finds the group of rules whose User-agent line matches its name most specifically, and falls back to the User-agent: * group if none does.

Within a group, the rule with the longest matching path wins. If an Allow and a Disallow rule match with the same length, Allow takes precedence. Paths are prefixes, and major crawlers also support * as a wildcard and $ to anchor the end of a URL.

The file applies only to the exact protocol and host it is served from. https://example.com/robots.txt does not cover https://shop.example.com, which needs its own file.

Worked example: the trailing slash matters

With the default rules Allow: /, Disallow: /admin/ and Disallow: /private/, a crawler may not fetch /admin/login or /private/report.pdf, because those paths start with a disallowed prefix and the Disallow rule is longer than Allow: /.

It may fetch /admin with no trailing slash, because '/admin' does not start with '/admin/'. It may also fetch /administrator. Writing Disallow: /admin without the slash does the opposite: it blocks /admin, /admin/, /administrator and /admin.php. Decide which you mean before publishing.

What robots.txt does not do

Disallowing a URL stops compliant crawlers from fetching it, but it does not stop the URL from being indexed. If other pages link to it, a search engine can still list the bare URL without a description. To keep a page out of results, allow crawling and add a noindex robots meta tag or X-Robots-Tag header, since a crawler that cannot fetch the page will never see the noindex.

robots.txt is also public. Anyone can read it, so listing sensitive paths advertises where they are. Protect private areas with authentication, not with a Disallow line.

Do not block CSS and JavaScript files that pages need to render. Search engines render pages much like a browser, and blocked resources can make a page look broken to them.

Building out the sitemap

The sitemap protocol published at sitemaps.org allows up to 50,000 URLs and 50 MB uncompressed per file. Larger sites split URLs across several sitemaps and list them in a sitemap index file. Each loc must be a full absolute URL on the same host as the sitemap.

Google has said it ignores the changefreq and priority values, and uses lastmod only when it is consistently accurate. Updating lastmod on every page each day, whether the content changed or not, teaches crawlers to ignore it. Set it to the date the page content last changed meaningfully.

To build one by hand here, paste your URLs into the Sitemap URLs box, one per line. Full addresses are used as they are, and paths such as /about/ are joined to the base URL; blank lines and duplicates are skipped, and characters such as & in query strings are escaped as XML requires. Lastmod, changefreq and priority are optional and, when set, apply to every URL in the list, so leave lastmod empty unless all the pages really changed on that date.

Most CMS platforms and frameworks can generate a complete sitemap automatically, which is easier to keep accurate for a large site. Whichever way you build it, submit the sitemap URL in Google Search Console and Bing Webmaster Tools as well as listing it in robots.txt.

Checking the file before and after publishing

Make sure robots.txt is served as plain text from the root of the site and returns a 200 status. Google Search Console has a robots.txt report that shows the version Google last fetched and any lines it could not parse.

The most damaging mistake is copying a staging site's file to production. Staging environments often use Disallow: / to keep crawlers out entirely, and if that line goes live, search engines stop crawling the whole site. Check robots.txt as part of every launch.

Robots.txt & Sitemap Generator: frequently asked questions

Does the line Allow: / do anything?

Not on its own, because everything is allowed unless a rule disallows it. It is harmless, and it makes the intent of the file clear to anyone reading it.

What happens if my robots.txt is missing or returns an error?

If the file returns a 404 or another 4xx status, crawlers treat the site as having no restrictions. Google treats a 5xx server error as a temporary instruction not to crawl the site, so a broken robots.txt on a misconfigured server can halt crawling.

Does Google support Crawl-delay?

No. Google ignores Crawl-delay, though some other crawlers such as Bingbot honour it. If Googlebot is putting too much load on a server, the usual signal is to return 503 or 429 responses temporarily.

Can I list more than one sitemap in robots.txt?

Yes. Add a separate Sitemap: line for each sitemap or sitemap index, each with a full absolute URL. Sitemap lines are independent of User-agent groups and can appear anywhere in the file.

All seo tools & web guides