Search & Research

Web Crawlers Explained

Learn what web crawlers do, how they choose pages, what robots.txt controls and how to spot them in logs.

Key takeaways

  • A crawler fetches a page, extracts its links, adds new addresses to a queue and repeats, usually across many machines at once.
  • The robots.txt file asks crawlers to stay out of certain paths, but it is a request that only cooperative bots honor.
  • Blocking a page from crawling is different from keeping it out of search results; a noindex instruction needs to be read to work.
  • Anyone can fake a crawler's name, so verify important bots by their network address and not their label alone.

A web crawler is a program that visits web pages automatically, reads them and follows their links to find more pages. Search engines use crawlers to build their indexes, and so do archives, price monitors, link checkers, security scanners and AI companies gathering text.

If you run a website, crawlers are probably some of your most frequent visitors. If you only browse, they're the reason search results exist at all. Either way, it helps to know how they decide where to go and what you can ask of them.

The basic loop

Every crawler follows roughly the same cycle. It keeps a list of addresses to visit, often called the frontier. It takes one, looks up the server's address through DNS, sends an HTTP request and receives a response. It then parses what came back, records the content and collects the links.

Before new links go into the frontier, the crawler cleans them up. It resolves relative paths into full addresses, drops fragments after the # sign, and checks whether it has already seen the address. Without that check, a crawler would circle the same pages forever.

The response status matters too. A 200 means the page arrived. A 301 or 308 says it has moved permanently, so the crawler should follow and remember the new address. A 404 or 410 says there's nothing there. A run of 500 or 503 errors suggests the server is struggling, and a considerate crawler slows down. A 429 means "too many requests" and is a direct request to back off.

The crawl loop
Queue Add unseen addresses for later Parse Pull out text and links Pick a URL Choose the next address from the queue Check rules Read robots.txt for that host Fetch Request the page and read the status 1 2 3 4 5 Pick a URL Choose the next address from the queue 1 Check rules Read robots.txt for that host 2 Fetch Request the page and read the status 3 Parse Pull out text and links 4 Queue Add unseen addresses for later 5

How crawlers decide what to visit

No crawler can fetch the entire web continuously, so it prioritizes. Pages that many others link to tend to be visited sooner. Pages that change often earn more frequent revisits, while static ones drift to a slower schedule.

Server capacity is the other limit. A crawler usually restricts how many requests it makes to one host at a time and pauses between them. Engineers call this politeness. If your server responds quickly and reliably, a search crawler may fetch more; if it slows or errors, the rate tends to drop.

For large sites, the total amount of attention a crawler is willing to spend is sometimes called the crawl budget. Small sites rarely need to think about it. Big shops and forums do, because endless filter combinations, session identifiers in addresses and calendar pages can soak up visits that should have gone to real content.

Crawlers also send a conditional request when they can. By including the date or an identifier from the last visit, they let your server reply 304 Not Modified without resending the page. The mechanism is explained in ETags and conditional requests.

Robots.txt: the posted rules

The Robots Exclusion Protocol, standardized as RFC 9309, lets a site publish instructions at a fixed location: /robots.txt at the root of the host. A crawler that follows the standard reads it before fetching other paths.

User-agent: *
Disallow: /cart/
Disallow: /search

User-agent: ExampleBot
Disallow: /

Sitemap: https://example.com/sitemap.xml

The first group applies to any crawler without a more specific match. The second blocks one named bot from everything. The Sitemap line is a widely supported extension that points to your page list. You can test how rules apply with the local robots.txt rule matcher.

Two cautions matter. First, robots.txt is voluntary. It does not password-protect anything, and a badly behaved program can ignore it. Second, the file is public, so listing a secret directory in it tells everyone that the directory exists. Protect private material with authentication.

Blocking crawling versus blocking indexing

This confuses many site owners. A Disallow rule stops compliant crawlers from fetching a page. It doesn't guarantee the address stays out of results. If other sites link to it, an engine may still list the bare address, sometimes with link text and no description.

To keep a page out of results, use a noindex instruction, either as a meta tag in the page or as an X-Robots-Tag HTTP header:

<meta name="robots" content="noindex">

X-Robots-Tag: noindex

The crawler has to be able to fetch the page to see either one. If you block the page in robots.txt and also add noindex, the bot may never read the instruction. For pages that must be private, require a login.

Sitemaps and other helpers

A sitemap is a file listing addresses you want discovered, usually in XML. Under the sitemap protocol, one file can hold up to 50,000 addresses and 50 MB uncompressed, and an index file can point to many sitemaps. A last-modified date helps crawlers spot changes, provided you set it honestly.

Sitemaps are suggestions. Listing a page doesn't force a crawl or an index entry. They're most useful for large sites, new sites with few inbound links and pages buried deep in navigation. The setup is covered in XML sitemaps and robots.txt.

Good internal links remain the most dependable aid. If a visitor can reach a page by clicking ordinary links from your homepage, a crawler usually can too.

JavaScript and modern pages

Many sites send a nearly empty HTML shell and build the page with JavaScript. A simple crawler sees only the shell. Some search crawlers render pages in a headless browser, which is a browser running without a visible window, but rendering costs far more than reading HTML and may happen later.

Other bots don't run scripts at all. If your important text and links exist only after scripts execute, some systems will miss them. Sending meaningful HTML from the server, or generating static pages, avoids the problem. Links should be real <a href> elements, not click handlers attached to other elements.

The kinds of bots you'll meet

Not every crawler wants the same thing.

  • Search crawlers build indexes that can send you visitors.
  • AI crawlers collect content for training models or for answering questions. Many publish separate user-agent names so owners can allow one purpose and refuse another. See how websites can control AI crawlers.
  • Archivers save copies for history.
  • Monitoring and link-preview bots check uptime or fetch a title and image when someone shares a link.
  • Scrapers and scanners range from legitimate research tools to abusive harvesters that ignore every rule.
Controls and what they actually do
robots.txt Asks bots not to fetch paths Voluntary compliance File is publicly readable noindex Asks engines not to list a page Page must be crawlable Set by meta tag or header Login Server refuses without credentials Works against rude bots too Right choice for private data Rate limit Caps request volume Can answer with status 429 Protects server capacity robots.txt Asks bots not to fetch paths Voluntary compliance File is publicly readable noindex Asks engines not to list a page Page must be crawlable Set by meta tag or header Login Server refuses without credentials Works against rude bots too Right choice for private data Rate limit Caps request volume Can answer with status 429 Protects server capacity

Recognizing crawlers in your logs

Each request carries a User-Agent header that names the client. Reputable bots identify themselves and often include a page describing their purpose. You can break one apart with the user-agent parser.

The header is trivial to forge, so don't grant special access based on it. Major search companies document ways to verify their crawlers, typically a reverse DNS lookup on the visiting address followed by a forward lookup that should return the same address, or a published list of address ranges. Reading server logs shows where to find these entries.

If a bot overwhelms your site, add a rule in robots.txt first. If it ignores the rule, use rate limiting, a web application firewall or your hosting provider's bot controls. Be careful with broad blocks, since shutting out a search crawler by accident can quietly remove you from results.

Common crawl problems on your own site

A few mistakes account for much of the trouble site owners run into, and each is easy to check.

A test site goes live with its blocking rule still in place. Developers often add Disallow: / to a staging copy, which is sensible, and then ship that file to production. After any launch or migration, open /robots.txt in your browser and read it.

Styles and scripts are blocked. If a crawler that renders pages can't load the files that build the layout, it may judge the page as broken or empty. Let search bots fetch the resources a normal visitor needs.

Redirects form chains or loops. Each hop costs a request, and a loop ends the attempt. Point old addresses directly at their final destination, as described in redirecting pages without losing visitors.

Missing pages answer with success. Some sites show a friendly "not found" message while returning status 200. Crawlers then treat thousands of empty addresses as real pages. Send a true 404 or 410.

Address spaces run without end. A "next month" link on a calendar, or filters that can be combined in any order, creates addresses faster than anyone can visit them. Limit which combinations are linked, and keep one preferred address for each piece of content.

When something looks wrong, test a single address. The inspection tool in a webmaster console typically shows what the engine fetched, which status it received and whether a rule blocked it.

Common questions

Is crawling the same as scraping?

They overlap. Crawling emphasizes discovering pages by following links. Scraping emphasizes extracting particular data from pages. Many programs do both, and whether a given use is permitted depends on site terms and local law, which differ and continue to change.

Can I make a crawler visit right now?

You can ask. Webmaster consoles commonly offer a way to request indexing of a single address, with limits and no promise of timing. Some engines also accept change notifications through protocols such as IndexNow.

Will blocking all bots speed up my site?

It may reduce load, but it also removes you from search and breaks link previews. Look at which bots are actually costing you capacity and handle those specifically.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Search & Research →

Latest news on this topic