How to verify Googlebot, GPTBot and other crawler visits

Anyone can send a request with “Googlebot” or “GPTBot” in the user agent. To know a visit is real, check the IP address: with a reverse DNS lookup, or against the IP ranges the operator publishes. This guide shows both, with tested code.

Tested on 27 November 2026.

Bot IP checker: is it really Googlebot, GPTBot or ClaudeBot?

Why the user agent is not enough

The user-agent header is plain text that the client chooses. Scrapers often pretend to be Googlebot because many sites let it through firewalls and paywalls, and Common Crawl warns that other crawlers falsely identify themselves as CCBot.

So a log line that says GPTBot only tells you what the client claimed. Before you allow, block or count a crawler, check where the request came from.

Two methods

1. Reverse DNS, then forward DNS
Look up the hostname of the IP. It must end in the operator's domain (for Googlebot, googlebot.com). Then look up that hostname: it must return the same IP. The second step matters, because whoever controls an IP range can set its reverse record to any name.
2. Published IP ranges
Most AI crawler operators publish a JSON file of IP ranges instead of hostnames. The IP must fall inside one of the listed prefixes. Download the file regularly (once a day is plenty) rather than on every request.

Where each operator documents it

Google's other crawlers and user-triggered fetchers can also resolve to google.com or googleusercontent.com and have their own IP files. Common Crawl's reverse DNS works over IPv4 only. Yandex publishes no IP list, so use reverse and forward DNS.

Check one IP by hand

On Linux or macOS, the host command does both lookups. A real Googlebot IP resolves to a googlebot.com name, and that name resolves back to the same IP:

$ 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

Check with Python

This script uses only the standard library. It runs the DNS check for operators that document a hostname, and the IP-range check for all of them.

#!/usr/bin/env python3
"""Check whether an IP address really belongs to a crawler.

    python3 verify_bot.py googlebot 66.249.66.1

Two methods, as the operators document them: reverse DNS plus a forward lookup that must
return the same IP, and the operator's published IP ranges (JSON with ipv4Prefix/ipv6Prefix).
"""
import ipaddress, json, socket, sys, urllib.request

# Hostname suffixes the reverse lookup must end in (only for operators that document one).
RDNS = {
    'googlebot': ('.googlebot.com', '.google.com'),
    'bingbot': ('.search.msn.com',),
    'applebot': ('.applebot.apple.com',),
}
# Published IP ranges.
IP_LISTS = {
    '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',
    'oai-searchbot': 'https://openai.com/searchbot.json',
    'chatgpt-user': 'https://openai.com/chatgpt-user.json',
    'claudebot': 'https://claude.com/crawling/bots.json',
    'perplexitybot': 'https://www.perplexity.ai/perplexitybot.json',
    'applebot': 'https://search.developer.apple.com/applebot.json',
}


def reverse_dns(ip, suffixes):
    """Hostname if the reverse lookup ends in a suffix and resolves back to the same IP."""
    try:
        host = socket.gethostbyaddr(ip)[0].rstrip('.')
    except OSError:
        return None
    if not host.endswith(suffixes):
        return None
    try:
        forward = {ipaddress.ip_address(a[4][0]) for a in socket.getaddrinfo(host, None)}
    except OSError:
        return None
    return host if ipaddress.ip_address(ip) in forward else None


def in_ip_list(ip, url):
    req = urllib.request.Request(url, headers={'User-Agent': 'verify-bot/1.0'})
    with urllib.request.urlopen(req, timeout=10) as r:
        prefixes = json.load(r).get('prefixes', [])
    addr = ipaddress.ip_address(ip)
    for p in prefixes:
        net = p.get('ipv4Prefix') or p.get('ipv6Prefix')
        if net and addr in ipaddress.ip_network(net):
            return net
    return None


def main():
    if len(sys.argv) != 3 or sys.argv[1] not in IP_LISTS:
        sys.exit(f'usage: verify_bot.py <{"|".join(IP_LISTS)}> <ip>')
    bot, ip = sys.argv[1], sys.argv[2]
    if bot in RDNS:
        host = reverse_dns(ip, RDNS[bot])
        print(f'reverse DNS: {host or "no match"}')
    net = in_ip_list(ip, IP_LISTS[bot])
    print(f'IP list:     {net or "not listed"}')
    ok = bool(net) or (bot in RDNS and bool(host))
    print(f'{ip} is {"a real" if ok else "NOT a real"} {bot}')
    sys.exit(0 if ok else 1)


if __name__ == '__main__':
    main()

Output:

$ python3 verify_bot.py googlebot 66.249.66.1
reverse DNS: crawl-66-249-66-1.googlebot.com
IP list:     66.249.66.0/27
66.249.66.1 is a real googlebot

$ python3 verify_bot.py gptbot 1.1.1.1
IP list:     not listed
1.1.1.1 is NOT a real gptbot

Check in PHP

The DNS check in a few lines, for example before you let a “Googlebot” past a rate limit:

<?php
// Reverse DNS, then a forward lookup that must return the same IP.
// gethostbynamel() returns IPv4 addresses only; use dns_get_record() for IPv6.
function is_real_crawler(string $ip, array $suffixes): bool {
    $host = gethostbyaddr($ip);
    if ($host === false || $host === $ip) return false;
    $match = false;
    foreach ($suffixes as $s) {
        if (str_ends_with($host, $s)) { $match = true; break; }
    }
    if (!$match) return false;
    return in_array($ip, gethostbynamel($host) ?: [], true);
}

is_real_crawler('66.249.66.1', ['.googlebot.com', '.google.com']); // true
is_real_crawler('157.55.39.1', ['.search.msn.com']);                // true
is_real_crawler('8.8.8.8', ['.googlebot.com', '.google.com']);     // false

Find fake crawlers in your access log

Feed every IP that claimed to be a crawler to the script and print the ones that fail:

# Every IP that claimed to be GPTBot in an access log (combined format), checked once
grep -i 'gptbot' access.log | awk '{print $1}' | sort -u | while read ip; do
  python3 verify_bot.py gptbot "$ip" > /dev/null || echo "fake: $ip"
done

Things to watch

  • Cache the result per IP: DNS lookups are slow, and the same crawler IPs come back all day.
  • Handle IPv6. Google, for example, crawls over IPv6 too; Python's ipaddress module handles both.
  • A failed check is not always an attack: some operators run several bots from the same ranges (Anthropic's single file covers ClaudeBot, Claude-SearchBot and Claude-User), so check against the right list.
  • Verifying does not mean allowing. Decide per crawler in robots.txt; see the AI crawler user-agent list for the tokens.

AI crawler user agents: the full list

Let NMOS.NET verify every visit

NMOS.NET runs these checks on every crawler visit to your site and marks each one as verified or fake, so you see real Googlebot and GPTBot traffic apart from imitators.