Xerobit
Dev Productivity

How to Verify Googlebot: Reverse DNS, Forward DNS and Fake UA Spoofing

A Googlebot user agent proves nothing. Verify it with reverse and forward DNS or Google's IP range JSON, with real command output and a tested Node and Express implementation.

MA Mian Ali Khalid Updated Nov 19, 2026 7 min read
Free tool
User Agent Parser
Parse any User-Agent string into browser, OS, device, and engine. Or detect your own. Built on the maintained ua-parser-js dataset.
Open tool →
On this page ⌄
  1. Method 1: reverse DNS, then forward DNS
  2. Method 2: Google's published IP ranges
  3. Run on a larger sample (2026-11-19)
  4. The DNS check in Node
  5. Express middleware, tested
  6. Bingbot and other crawlers
  7. Decoding the string
  8. Tested

Anyone can send User-Agent: ...Googlebot/2.1.... Scrapers do, to get past paywalls and rate limits that exempt search crawlers. Google's crawler documentation says "The HTTP user agent string can be spoofed" and links to the verification guide, which gives two methods, DNS and IP ranges. This guide runs both, with real output from 2026-11-02 and a larger run on 2026-11-19, then wires them into Express and covers Bingbot.

Method 1: reverse DNS, then forward DNS

The steps from Google's documentation:

  1. Reverse-lookup the client IP from your logs.
  2. Check that the hostname ends in googlebot.com, google.com or googleusercontent.com.
  3. Forward-lookup that hostname and confirm it returns the original IP.

Step 3 is not optional: anyone who controls the reverse DNS for their own IP block can make it return crawl-1-2-3-4.googlebot.com, but they cannot make Google's DNS return their IP for that name.

Real runs (Windows nslookup; Google's docs use the host command, with the same meaning):

> nslookup 66.249.66.1
Name:    crawl-66-249-66-1.googlebot.com
Address:  66.249.66.1

> nslookup crawl-66-249-66-1.googlebot.com
Name:    crawl-66-249-66-1.googlebot.com
Address:  66.249.66.1

The reverse name resolves forward to the same address, so this is a real Google crawler IP. Now a fake: a visitor at 8.8.8.8 claiming to be Googlebot.

> nslookup 8.8.8.8
Name:    dns.google
Address:  8.8.8.8

The hostname is not in a Google crawler domain, so the check fails at step 2. An IP with no reverse record at all (203.0.113.9, a documentation address, was used) fails at step 1.

The hostname patterns in Google's documentation are crawl-***-***-***-***.googlebot.com and geo-crawl-***-***-***-***.geo.googlebot.com for common crawlers, rate-limited-proxy-***-***-***-***.google.com for special crawlers, and ***-***-***-***.gae.googleusercontent.com or google-proxy-***-***-***-***.google.com for user-triggered fetchers.

Method 2: Google's published IP ranges

Google publishes CIDR lists as JSON. The page for verifying Google requests lists these files (all under https://developers.google.com/static/crawling/ipranges/):

FileFor
common-crawlers.jsonGooglebot and other common crawlers
special-crawlers.jsoncrawlers such as AdsBot
user-triggered-fetchers.jsonfetchers triggered by a user action
user-triggered-fetchers-google.jsonthe Google-operated fetchers
user-triggered-agents.jsonuser-triggered agents

Downloaded common-crawlers.json had a creationTime of 2026-11-02T15:46:04 and 317 prefixes (170 IPv4, the rest IPv6) in objects like {"ipv6Prefix": "2001:4860:4801:10::/64"} and {"ipv4Prefix": "192.178.4.0/27"}. The older URL under /static/search/apis/ipranges/googlebot.json still returned a file of the same size, but use the documented new path. Re-download the file on a schedule rather than hard-coding ranges; no statement of how often it changes was found, so treat it as changing.

Matching an IP to the ranges is fast and needs no DNS. Using Node's net.BlockList:

import net from 'node:net';
const ranges = JSON.parse(await fs.readFile('common-crawlers.json', 'utf8'));
const bl = new net.BlockList();
for (const p of ranges.prefixes) {
  const [addr, len] = (p.ipv4Prefix ?? p.ipv6Prefix).split('/');
  bl.addSubnet(addr, Number(len), p.ipv4Prefix ? 'ipv4' : 'ipv6');
}
const inRanges = (ip) => bl.check(ip, net.isIPv6(ip) ? 'ipv6' : 'ipv4');

On a dual-stack Node server req.ip can arrive as an IPv4-mapped address such as ::ffff:66.249.66.1; strip the ::ffff: prefix before the range check or the lookup will fail for real crawlers.

Results with that code:

IPIn common-crawlers.jsonReverse and forward DNS
66.249.66.1yesok, crawl-66-249-66-1.googlebot.com
66.249.64.10yesok, crawl-66-249-64-10.googlebot.com
2001:4860:4801:10::5yesok, a .googlebot.com name
8.8.8.8nofails, dns.google
203.0.113.9nofails, no reverse record

The two methods agreed on all five. A DNS lookup took 450 to 860 ms for real Google IPs and a few ms for failures on the test machine, against microseconds for the range check, which is why you want the range check first and a cache.

Run on a larger sample (2026-11-19)

Five IPs prove little, so the checker was run again over addresses taken from the published files. The Python script (dnspython 2.9.2, Python 3.11.15) did the reverse lookup, required a Google domain suffix, did the forward lookup and compared. Addresses came from common-crawlers.json (creationTime 2026-11-18T15:45:52, 317 prefixes, 170 of them IPv4; the HTTP last-modified header was 18 November 2026): one address from each of 12 randomly chosen IPv4 prefixes (seed 7) and one from each of 6 random IPv6 prefixes.

66.249.68.101  66.249.68.96/27   PASS  crawl-66-249-68-101.googlebot.com
34.176.130.21  34.176.130.16/28  PASS  geo-crawl-34-176-130-21.geo.googlebot.com
192.178.6.197  192.178.6.192/27  PASS  crawl-192-178-6-197.googlebot.com
...
PASS 12 of 12 (IPv4)
2001:4860:4801:45::5  PASS  crawl-2001-4860-4801-0045-0000-0000-0000-0005.googlebot.com
PASS 6 of 6 (IPv6)
8.8.8.8      FAIL step2: dns.google not in a Google domain
1.1.1.1      FAIL step2: one.one.one.one not in a Google domain
203.0.113.9  FAIL step1: no reverse record

All 18 sampled addresses from Google's file passed the DNS method, so the two methods agree on this sample, and three non-Google addresses failed at the step the method predicts. The sampled hosts include a geo-crawl-...geo.googlebot.com name, one of the patterns in Google's documentation. The sampled addresses were chosen inside the published prefixes (the fifth address of each, or the fifth address of the /27), not taken from a server log, so they show that the two methods agree, not that Google sent a request from each of them.

One tooling trap showed up in the IPv6 part. Python's socket.getaddrinfo(host, None, AF_INET6) raised getaddrinfo failed on this Windows machine for the AAAA-only name crawl-2001-4860-4801-0010-0000-0000-0000-0005.googlebot.com, while nslookup -type=AAAA returned 2001:4860:4801:10::5 for the same name. A first version of the script built on getaddrinfo therefore reported six false failures on the forward step; switching to a DNS library gave the six passes above. If your forward lookup fails for IPv6, check the resolver call before concluding that the visitor is fake. Node's dns.resolve6 in the code below is a direct DNS query and was not affected.

The DNS check in Node

import dns from 'node:dns/promises';
import net from 'node:net';

const SUFFIXES = ['.googlebot.com', '.google.com', '.googleusercontent.com'];

async function verifyByDns(ip) {
  try {
    for (const host of await dns.reverse(ip)) {
      if (!SUFFIXES.some((s) => host.endsWith(s))) continue;
      const fwd = net.isIPv6(ip) ? await dns.resolve6(host) : await dns.resolve4(host);
      if (fwd.map((a) => a.toLowerCase()).includes(ip.toLowerCase())) return { ok: true, host };
    }
  } catch { /* ENOTFOUND etc: treat as not verified */ }
  return { ok: false };
}

Compare endsWith('.googlebot.com') with the leading dot: evilgooglebot.com must not pass. For IPv6, compare normalised text, because the address may be written in more than one form.

Express middleware, tested

const cache = new Map();                          // ip -> { ok, at }
async function realGooglebot(ip) {
  const hit = cache.get(ip);
  if (hit && Date.now() - hit.at < 24 * 3600e3) return hit.ok;
  const ok = inRanges(ip) || (await verifyByDns(ip)).ok;   // cheap check first
  cache.set(ip, { ok, at: Date.now() });
  return ok;
}

app.set('trust proxy', true);   // only behind a proxy you control
app.use(async (req, res, next) => {
  if (/Googlebot/i.test(req.get('user-agent') ?? '')) {
    req.isVerifiedGooglebot = await realGooglebot(req.ip);
    if (!req.isVerifiedGooglebot) return res.status(403).send('fake googlebot');
  }
  next();
});

Three requests were sent to this server with the X-Forwarded-For header set by the test client, all with the real desktop Googlebot UA from Google's documentation (Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html)) except the last:

CaseResult
IP 66.249.66.1, Googlebot UA200 hello real googlebot
IP 8.8.8.8, Googlebot UA403 fake googlebot
IP 8.8.8.8, browser UA200 hello (not checked, not a claim)

Two cautions. trust proxy makes Express believe X-Forwarded-For; if your server is directly reachable, anyone can set that header and pass the check, so enable it only behind your own load balancer. And blocking is a choice: only 403 fake Googlebots if you actually give Googlebot special treatment; otherwise, treat them as normal visitors and rate limit.

Bingbot and other crawlers

Microsoft's How to Verify that Bingbot is Bingbot post gives the same two steps: reverse lookup of the IP from your logs, confirm that the name ends with search.msn.com, then a forward lookup of that name that must resolve back to the same IP. Microsoft also serves a range file at https://www.bing.com/toolbox/bingbot.json; downloaded on 2026-11-19 it had creationTime 2024-01-03T10:00:00 and 29 IPv4 prefixes, in the same prefixes / ipv4Prefix shape as Google's files, so the BlockList code above loads it unchanged.

Run on the first five prefixes of that file with the suffix changed to .search.msn.com, every sampled address passed, for example 157.55.39.5 resolved to msnbot-157-55-39-5.search.msn.com and back. 8.8.8.8 is in none of Bing's prefixes. Only the file's creationTime was observed; Microsoft's page read for this guide does not say how often it changes, so keep reloading it. Microsoft's 2012 post pre-dates the range file and advises against hardcoding allow lists, so treat the DNS check as the primary test and the file as a cross-check.

For any other crawler, use the method that its operator documents: the reverse DNS suffix and the range file differ per company, and the Google suffix list above must never be reused for them.

SituationCheck
Rate limiting or blocking at the edge, high request volumeRange file first (microseconds, no network), cache the DNS result per IP for a day
Occasional log analysisReverse then forward DNS with host or nslookup
UA says Googlebot but the IP is in neither the ranges nor passes DNSTreat as an ordinary visitor and rate limit it; block only if you have a reason
IPv6 forward step fails in a scriptTest the name with nslookup -type=AAAA before trusting the script

Decoding the string

The User Agent Parser decodes a UA string into browser, OS and device. Its bot flag is a pattern match on words such as "bot" and "crawler" in the string, so it tells you what a client claims to be, not whether the claim is true. Use it to read a UA from your logs, and DNS or ranges to decide whether to trust it. Newer browsers also expose structured client information, see navigator.userAgentData.

Tested

2026-11-02: Node v25.8.0 with Express, Windows nslookup, and Google's common-crawlers.json downloaded that day. Google documentation read for the steps, domains, file names and the spoofing statement. The host command, special-crawlers.json and the other range files were not run. DuckDuckBot and other engines publish their own verification methods, which were not tested.

2026-11-19: Python 3.11.15 with dnspython 2.9.2 on Windows 11 for the 18-address sample and the Bingbot sample; common-crawlers.json (HTTP last-modified 18 Nov 2026) and bingbot.json downloaded that day; Google's verification and common-crawlers pages and Microsoft's 2012 Bingbot post read the same day. A Googlebot request from a sampled address was not observed in a log.

Keep reading

Related tools

Written by Mian Ali Khalid. More guides in Dev Productivity.