---
title: "RDAP vs WHOIS: Why You Should Use RDAP for IP Lookups"
description: "How RDAP differs from WHOIS in protocol, format and routing, with curl and jq commands to look up an IP's range, holder, country and abuse contact."
url: https://cdnping.org/en/blog/rdap-vs-whois-ip-lookup
language: en
published: 2026-10-27
category: "Developer tools"
tags: ["RDAP","WHOIS","IP lookup","command line","network troubleshooting"]
source: cdnping.org
license: Free to quote and summarize with a link to the url above.
---
# RDAP vs WHOIS: Why You Should Use RDAP for IP Lookups

To find out which network an IP belongs to, who it is registered to, and who to contact when something goes wrong, you used to use WHOIS. Today RDAP is the better choice. Both query the same registration data kept by the Regional Internet Registries (RIRs). The difference is that RDAP runs over HTTPS, returns structured JSON, and can automatically find the registry responsible for an address by using IANA's bootstrap files. If you are writing scripts, running bulk lookups, or just want predictable fields, RDAP saves you from parsing plain text.

## What is the difference between RDAP and WHOIS?

WHOIS is a very old protocol. The client opens a TCP connection to port 43, sends one line as the query, and the server replies with a block of plain text. The protocol does not define which fields to return or in what format, so the five RIRs each produce different output. Some use `inetnum:`, others use `NetRange:`, and field names, date formats and contact layouts all vary. Nothing is encrypted in transit either.

RDAP (Registration Data Access Protocol) was defined by the IETF in RFC 7480–7484 and later updated by RFC 9082 and RFC 9083. It is a REST-style interface:

| Aspect | WHOIS | RDAP |
|---|---|---|
| Transport | TCP port 43, plaintext | HTTPS |
| Response format | Plain text, differs by registry | JSON, fields defined by RFCs |
| Finding the right server | You must know it yourself, or rely on the client's built-in list and referrals | IANA bootstrap files provide the mapping, so it can be located automatically |
| Error handling | No common convention | HTTP status codes such as 404 and 429 |
| Internationalization | Encoding is uncertain | UTF-8 |
| Redirection | Some servers put referrals in the text | Standard HTTP redirects and the `links` field |

In everyday use, two differences matter most. You can pull fields straight out with jq instead of writing regular expressions, and you no longer need to remember which RIR manages which address block.

The domain world is also moving to RDAP. ICANN has made RDAP the authoritative way to query registration data for generic top-level domains. This article covers IP and ASN lookups only.

## How does RDAP know which RIR to ask?

Global IP address space is managed by five RIRs: ARIN, RIPE NCC, APNIC, LACNIC and AFRINIC. IANA maintains several bootstrap files that map address ranges to the RDAP service URL of the matching RIR:

- IPv4: `https://data.iana.org/rdap/ipv4.json`
- IPv6: `https://data.iana.org/rdap/ipv6.json`
- ASN: `https://data.iana.org/rdap/asn.json`

The `services` entry in each file is an array, and each item is a pair of "list of address ranges + list of service URLs". Given an IP, the client finds the longest prefix that contains it and sends the request to the matching service URL. You can take a look yourself:

```bash
curl -s https://data.iana.org/rdap/ipv4.json \
  | jq -r '.services[] | "\(.[1][0])  \(.[0] | length) prefixes"'
```

If you would rather not do the matching yourself, `rdap.org` is a public forwarding service. It reads the bootstrap files and redirects you to the right RIR with an HTTP 302. That is why you must add `-L` to curl so it follows redirects.

## Look up IP registration data with curl and jq

Make sure curl and jq are installed. The examples below use `1.1.1.1`; replace it with the IP you want to check. Your actual output is what counts.

### Step 1: Get the full JSON

```bash
IP=1.1.1.1
curl -sL "https://rdap.org/ip/$IP" -o rdap.json
jq 'keys' rdap.json
```

An IP query returns an object of type `ip network`. Commonly used fields:

| Field | Meaning |
|---|---|
| `handle` | The record's identifier at the RIR |
| `startAddress` / `endAddress` | First and last address of the network |
| `cidr0_cidrs` | The same network in CIDR notation (a cidr0 extension field; not every RIR returns it) |
| `name` | Network name, filled in by the holder |
| `type` | Allocation type, such as ALLOCATED or ASSIGNED |
| `country` | Registered country code |
| `parentHandle` | Identifier of the parent network |
| `entities` | Related organizations and contacts, each with `roles` |
| `events` | Registration, last-changed and similar timestamps |

### Step 2: Extract the key fields

```bash
jq -r '
  "handle:  \(.handle)",
  "range:   \(.startAddress) - \(.endAddress)",
  "cidr:    \([.cidr0_cidrs[]? | "\(.v4prefix // .v6prefix)/\(.length)"] | join(", "))",
  "name:    \(.name)",
  "type:    \(.type)",
  "country: \(.country)",
  "parent:  \(.parentHandle)"
' rdap.json
```

### Step 3: Find the abuse contact

Nesting differs between RIRs. Some put the abuse entity directly in the top-level `entities`, others put it under an organization entity. A recursive search handles both:

```bash
jq -r '
  [.. | objects | select((.roles? // []) | index("abuse"))]
  | .[] | .vcardArray[1][]? | select(.[0]=="email") | .[3]
' rdap.json | sort -u
```

Contact details are stored in `vcardArray` in jCard format, where `fn` is the name, `email` is the email address and `tel` is the phone number. If this level has no abuse entity, look at the parent network (see below).

### Step 4: Look up the ASN too

Often more useful than the network itself is which autonomous system announces the IP. RDAP can also return ASN registration data:

```bash
curl -sL https://rdap.org/autnum/13335 | jq -r '.handle, .name, .country'
```

Note that RDAP only gives registration data. It does not tell you which ASN currently announces a given IP in BGP. For that you need routing data; see [What is an ASN and how to look one up](/en/blog/what-is-asn-and-how-to-look-up).

## Why does an IP lookup return a whole block of addresses?

Like WHOIS, RDAP registers allocation blocks, not individual IPs. When you query one address, the server returns the smallest registered network that contains it, which might be a /24 or a /12. This leads to two common misreadings:

1. The network name is not necessarily the user. A large block may be registered to a carrier or cloud provider while the actual users are its customers. You only see finer detail when the holder has registered the sub-blocks (reallocation records).
2. `country` is the registered country, not where the IP is located. A company can register addresses in one country and use them in another. This is one reason geolocation databases and registration data often disagree; see [Why IP geolocation is inaccurate](/en/blog/why-ip-location-is-inaccurate). A mismatch between registered country and actual location is also one clue for spotting broadcast IPs; see [Native IP vs broadcast IP](/en/learn/native-ip-vs-broadcast-ip).

## Reading multi-level allocations in APNIC

Address space in the Asia-Pacific region often goes through several levels of allocation. APNIC allocates to a National Internet Registry (NIR, such as CNNIC in China) or a Local Internet Registry (LIR), and the LIR then assigns to customers. RDAP returns the most specific level. You can walk up using `parentHandle` and the `links` entries whose `rel` is `up`.

To view the whole chain:

```bash
url="https://rdap.org/ip/1.1.1.1"
while [ -n "$url" ] && [ "$url" != "null" ]; do
  j=$(curl -sL "$url")
  echo "$j" | jq -r '"\(.handle)\t\(.type)\t\(.name)\t\(.country)"'
  url=$(echo "$j" | jq -r '[.links[]? | select(.rel=="up") | .href][0]')
  sleep 1
done
```

If an RIR does not provide an `up` link, use `parentHandle` to look up the parent by hand. Choose the level according to your question:

| What you want to know | Which level to read |
|---|---|
| Who actually uses this IP | The most specific level (usually `type` is ASSIGNED or similar) |
| Where to send an abuse report | Start at the most specific level and go up to the first one with an abuse entity |
| Which carrier or LIR the block was first allocated to | The level where `type` is ALLOCATED or similar |
| Whether the whole block is managed by an NIR | Check the name and `remarks` of the upper-level record |

For address blocks managed by an NIR, APNIC may only return information down to the NIR or one of its members. Finer sub-allocations have to be checked in the NIR's own lookup service. ARIN uses different type terms, such as DIRECT ALLOCATION, REALLOCATION and REASSIGNMENT, but they read the same way: the lower you go, the closer you get to the actual user.

## When do you still need WHOIS?

RDAP has not made WHOIS disappear overnight. Port 43 is still useful in a few cases:

- On a machine that only has the system `whois` command, it is the quickest way to take a quick look: `whois -h whois.apnic.net 1.1.1.1`.
- When you need certain objects in an RIR database (such as route and as-set). These are routing registry data, and RDAP does not necessarily cover them.
- Legacy internal scripts depend on the text format, and you need to run both in parallel for a while to verify before migrating.

If you maintain such scripts, a sensible migration path is: switch the query to RDAP and parse JSON, record the field mapping in code comments, and keep WHOIS as a fallback for when RDAP returns 404 or times out.

## What to watch for in bulk lookups

- Control your request rate. RIR RDAP services generally rate-limit and return HTTP 429 when you exceed the limit. Add delays in bulk scripts and back off according to the `Retry-After` response header instead of hammering the server with concurrent requests.
- Cache networks, not single IPs. After you get `startAddress`/`endAddress`, reuse the result for other addresses in the same range and you will send far fewer requests.
- Handle 404. Unallocated, reserved or private addresses (such as 10.0.0.0/8) have no registration record, so your script should distinguish "not found" from "error".
- Query the RIR directly. In production you can read the bootstrap files yourself and send requests straight to the matching RIR. That removes one forwarding hop and avoids depending on a third-party service's availability.

## Want to compare with a web result?

The network registration data shown by cdnping's [IP and environment check (/en/ip)](/en/ip) is fetched through RDAP. The page also shows location votes from 11 geolocation databases, the IP type and a cleanliness score, so you can compare them with the `handle`, network range and country you get on the command line. If the network matches but the geolocation differs from the registered country, it is usually the "registered location is not the usage location" issue described above. How each check is measured is documented on the [methodology](/en/methodology) page.

To go further and judge whether an IP is a data center or a home broadband connection, the holder name in the registration data is one clue but not the whole story. Continue with [Datacenter IP vs residential IP](/en/blog/datacenter-ip-vs-residential-ip). If you only want to know the carrier, [How to find which carrier an IP belongs to](/en/blog/find-ip-isp-carrier) covers three approaches: web, command line and bulk. For an overview of what an IP can reveal, see [What your IP address actually reveals](/en/blog/what-your-ip-address-reveals).

## Quick reference

```bash
# IP network
curl -sL https://rdap.org/ip/<IP> | jq '{handle,startAddress,endAddress,name,type,country,parentHandle}'
# ASN
curl -sL https://rdap.org/autnum/<ASN> | jq '{handle,name,country}'
# Abuse email
curl -sL https://rdap.org/ip/<IP> | jq -r '[..|objects|select((.roles?//[])|index("abuse"))][]|.vcardArray[1][]?|select(.[0]=="email")|.[3]'
# View the bootstrap mapping
curl -s https://data.iana.org/rdap/ipv4.json | jq '.services | length'
```

For protocol details, refer to IETF RFC 9082, RFC 9083 and each RIR's RDAP documentation.
