How to verify Googlebot and other good bots

Advanced5 min readUpdated

GET /learn/scraping/how-to-verify-good-bots/ Accept text/html text/markdown

Short answer

Do not trust the User-Agent header, because any client can claim to be Googlebot. Verify the source instead: run a reverse DNS lookup on the IP, check that the hostname ends in the operator's domain, such as googlebot.com or search.msn.com, then confirm the hostname resolves back to the same IP. For speed, match IPs against the operator's published range files.

Scrapers often send a Googlebot user agent, because many sites exempt search engines from rate limits and challenges. Common Crawl's own documentation notes that other crawlers falsely identify themselves as CCBot. A rule that trusts the User-Agent header gives those scrapers the same access as the real crawler. Verify where the request comes from instead, using DNS, published IP ranges or, where the operator supports it, a cryptographic signature.

Why the User-Agent header proves nothing

The User-Agent is a header the client writes itself, and any HTTP client can set it to any value. The source IP address is harder to fake for a full HTTP request, because the TCP connection only completes if replies can reach that address. Verification ties the request to the network that owns the IP.

Reverse DNS maps an IP address back to a hostname through a PTR record. Whoever controls an IP block sets its PTR records, so anyone can make their own server's IP resolve to a name like crawl-1-2-3-4.googlebot.com. The forward lookup closes that gap: only Google controls DNS for googlebot.com, so if that name resolves back to the same IP, the IP belongs to Google.

How to verify Googlebot with reverse and forward DNS

Google's verification steps are:

  1. Run a reverse DNS lookup on the IP address from your logs.
  2. Check that the hostname is in googlebot.com, google.com or googleusercontent.com.
  3. Run a forward DNS lookup on that hostname.
  4. Check that it returns the original IP address.
bash
$ host 66.249.66.1
1.66.249.66.in-addr.arpa domain name pointer crawl-66-249-66-1.googlebot.com.
$ host crawl-66-249-66-1.googlebot.com
crawl-66-249-66-1.googlebot.com has address 66.249.66.1

The hostname also tells you which kind of Google client you are dealing with. Googlebot and the other common crawlers resolve to crawl-...googlebot.com or geo-crawl-...geo.googlebot.com. Special-case crawlers such as AdsBot resolve to rate-limited-proxy-...google.com. User-triggered fetchers resolve to google-proxy-...google.com or ...gae.googleusercontent.com.

Treat googleusercontent.com with care. Virtual machines rented by Google Cloud customers also get reverse names in that domain, so accept it only when the IP is also in Google's user-triggered fetchers list.

How to verify Bingbot

Bingbot uses the same method with the domain search.msn.com:

bash
$ host 157.55.39.1
1.39.55.157.in-addr.arpa domain name pointer msnbot-157-55-39-1.search.msn.com.
$ host msnbot-157-55-39-1.search.msn.com
msnbot-157-55-39-1.search.msn.com has address 157.55.39.1

A script to verify Google and Bing crawlers

bash
#!/usr/bin/env bash
# Usage: verify-crawler.sh <ip>
ip="$1"

name=$(host "$ip" | awk '/domain name pointer/ {print $NF; exit}')
if [ -z "$name" ]; then
  echo "$ip: no reverse DNS record, not a verified crawler"
  exit 1
fi

case "$name" in
  *.googlebot.com.|*.google.com.) operator="Google" ;;
  *.search.msn.com.) operator="Bing" ;;
  *)
    echo "$ip: reverse DNS is $name, not a Google or Bing crawler"
    exit 1
    ;;
esac

if host "$name" | awk '/has (IPv6 )?address/ {print $NF}' | grep -qxF "$ip"; then
  echo "$ip: verified $operator crawler ($name)"
else
  echo "$ip: $name does not resolve back to $ip, treat as spoofed"
  exit 1
fi

The case patterns start with a dot and end with the trailing dot that host prints, so a hostname such as crawl.evilgooglebot.com does not match. The forward check uses grep -x for an exact line match, so 66.249.66.1 does not accept 66.249.66.10. It handles IPv4 and IPv6, and leaves out googleusercontent.com for the reason above.

Use published IP range files for speed

Two DNS lookups per request are too slow for a busy site. Most operators publish JSON files of their ranges in CIDR notation, a network written as an address and a prefix length, such as 192.178.4.0/27:

Amazon lists Amazonbot's addresses through its Amazonbot page. These files share one shape, a prefixes array of ipv4Prefix or ipv6Prefix entries, so one loader handles them all. This Node.js module loads three of them into the built-in BlockList:

js
import { BlockList, isIPv6 } from "node:net";

const SOURCES = {
  Googlebot: "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
  Bingbot: "https://www.bing.com/toolbox/bingbot.json",
  GPTBot: "https://openai.com/gptbot.json",
};

async function loadRanges(url) {
  const res = await fetch(url);
  if (!res.ok) throw new Error(`${url} returned ${res.status}`);
  const { prefixes } = await res.json();
  const list = new BlockList();
  for (const p of prefixes) {
    const cidr = p.ipv4Prefix ?? p.ipv6Prefix;
    const [network, bits] = cidr.split("/");
    list.addSubnet(network, Number(bits), p.ipv4Prefix ? "ipv4" : "ipv6");
  }
  return list;
}

const lists = Object.fromEntries(
  await Promise.all(
    Object.entries(SOURCES).map(async ([bot, url]) => [bot, await loadRanges(url)])
  )
);

export function isFromBot(bot, ip) {
  return lists[bot]?.check(ip, isIPv6(ip) ? "ipv6" : "ipv4") ?? false;
}

Call isFromBot("Googlebot", ip) only for requests whose user agent claims to be Googlebot, and reload the lists on a schedule. If your site sits behind a CDN, use the client IP the CDN passes on, not the CDN's own address. The AI crawlers behind these lists are described in what are AI crawlers?.

Web Bot Auth: signed requests from bots and agents

IP checks work poorly for agents that run in cloud browsers on shared infrastructure, and for operators that cannot keep a stable list. Web Bot Auth identifies the bot with a key instead. The bot signs each request using HTTP Message Signatures (RFC 9421) and sends three headers: Signature, Signature-Input, and Signature-Agent, which holds the URL of the operator's key directory at /.well-known/http-message-signatures-directory. The site, or its CDN, fetches the public key and checks the signature. A valid signature proves the request came from whoever holds the private key, whatever IP address it used.

HTTP Message Signatures is a published RFC, but the parts specific to bots, such as the key directory format and how a bot attaches its identity, are still Internet-Drafts. The IETF has chartered a Web Bot Auth working group to turn them into a standard. Some operators already sign: OpenAI documents that its ChatGPT cloud browser signs requests with Signature-Agent: "https://chatgpt.com", and it names Cloudflare, Akamai, HUMAN and Vercel as services that verify those signatures automatically. Most crawlers do not sign yet, so keep DNS and IP checks as the default and use signatures as a stronger check where they exist. AI agents vs bots covers how signed agents fit into a wider policy.

What to do with the result

  • If the crawler is verified, skip challenges and give it a generous rate limit. Google slows its crawling when your server returns 429, 500 or 503 responses, but long runs of these errors can lead it to drop URLs from its index, so set the limit well above its normal crawl rate.
  • If a client claims to be a known bot and fails verification, treat it as spoofed. Block or challenge it and log the IP.
  • If a client makes no such claim, run it through normal bot detection.

Cache each verification result per IP for about 24 hours as a starting point. Before you deploy a rule that could touch search crawlers, compare Search Console crawl stats for the week before and after. Cloudflare users can skip the DNS work with its verified bot field, described in how to block bots with Cloudflare.

Tools that help

StopBots is published by Kairal, which is one of the tools listed. The list is not a ranking.

  • Cloudflare verified bots is a directory of known good bots that Cloudflare verifies, including through Web Bot Auth, and exposes to rules through the cf.client.bot field.
  • AWS WAF Bot Control verifies common self-identifying bots such as search engine crawlers and labels them, so rules can separate real crawlers from impostors.
  • Akamai Bot Manager keeps a directory of known bots for Akamai customers and, according to OpenAI, verifies signed ChatGPT cloud browser requests.

Common questions

Does Google publish Googlebot IP addresses?

Yes. Google publishes JSON files of crawler ranges, split into common crawlers, special-case crawlers and user-triggered fetchers. Its broader list of all Google IP addresses also covers other services, so a match against that list does not prove a request came from a crawler.

Should I block requests that claim to be Googlebot but fail verification?

Block or challenge them. A real Googlebot request passes the DNS check, so a clear failure, as opposed to a DNS timeout, means the client lied about who it is, which is a strong reason to distrust the rest of its traffic.

How often should I refresh crawler IP lists?

Daily is a safe starting point. Most of these files carry a creationTime field, so you can skip the update when it has not changed, and keep the last good copy if a download fails.