ScreenshotNeo

BlogHow-to

How to Find the ASN of an IP Address

Find an IP address’s ASN with ARIN RDAP, RIPEstat, Team Cymru, command-line requests, and scripts—and understand conflicting results.

By the ScreenshotNeo team30 September 20267 min read

How to Find the ASN of an IP Address

Short answer: Look up the address in an Internet Registry Information Service such as ARIN RDAP, then compare it with routing data from RIPEstat or Team Cymru. Registration data identifies the network that holds an address block; routing data identifies the autonomous system currently originating or announcing a route. Those answers can differ.

What an ASN tells you

An Autonomous System Number (ASN) identifies an autonomous system used in Internet routing and registration records. An autonomous system is a network or group of networks managed under one routing policy. An ASN lookup can help you identify the registered network, organization, announced route, or likely upstream relationship for an IP address.

Decide which question you need to answer before choosing a source:

Question Best starting point What you get
Who holds or registered this address block? ARIN Whois/RDAP (or the regional registry responsible for the address) Network object, organization, and related registration entities
Which ASN is announcing this address right now? RIPEstat or another routing-data source Observed routing and origin information
Can I cross-check an IP-to-ASN result? Team Cymru Independent IPv4 or IPv6 IP-to-ASN lookup

Method 1: Use ARIN Whois/RDAP

Browser steps

  1. Copy the complete IPv4 or IPv6 address. Preserve IPv6 colons and compressed notation.
  2. Open ARIN Whois/RDAP and enter the address. ARIN’s search recognizes a specific IP format and returns the network and related-entity information for that address.
  3. Read the network object, organization, and any ASN or aut-num relationship in the result.
  4. Record the address, timestamp, network name, and ASN fields. This makes later changes explainable.

ARIN issues four-byte ASNs. When searching for an ASN, ARIN allows the AS prefix to be omitted. RDAP is defined for IP-network and ASN searches in RFC 9910.

ARIN RDAP with cURL

IP="192.0.2.1"
curl --fail --silent --show-error \
  "https://rdap.arin.net/registry/ip/${IP}" \
  -H "Accept: application/rdap+json"

Replace the documentation address with the address you need to investigate. The response is JSON. Fields can include a network handle, name, start and end addresses, country, remarks, entities, and links. The exact presence of an ASN relationship depends on the registry data.

ARIN RDAP in Python

import ipaddress
import requests

ip = "192.0.2.1"
ipaddress.ip_address(ip)  # raises ValueError for invalid input

url = f"https://rdap.arin.net/registry/ip/{ip}"
response = requests.get(
    url,
    headers={"Accept": "application/rdap+json"},
    timeout=20,
)
response.raise_for_status()
data = response.json()
print(data.get("name"))
print(data.get("handle"))
for entity in data.get("entities", []):
    print(entity.get("handle"), entity.get("roles"))

ARIN RDAP in Node.js

const ip = '192.0.2.1';
const res = await fetch(`https://rdap.arin.net/registry/ip/${ip}`, {
  headers: { Accept: 'application/rdap+json' }
});
if (!res.ok) throw new Error(`RDAP failed: ${res.status}`);
const data = await res.json();
console.log(data.name, data.handle);
for (const entity of data.entities ?? []) {
  console.log(entity.handle, entity.roles);
}

Method 2: Use RIPEstat for routing data

RIPEstat accepts IPv4 and IPv6 addresses as well as ASN, prefix, range, hostname, and country-code searches. Its web interface is useful for a one-off check; its API is intended for developers and network operators who need repeatable queries.

Registration records and observed BGP routes can answer different ASN questions.
Registration records and observed BGP routes can answer different ASN questions.
  1. Enter the IP address in the RIPEstat web interface.
  2. Inspect the routing or announced-origin information.
  3. Note the query time and the returned ASN or origin set.
  4. For automation, use the current RIPEstat API documentation to select the appropriate data call and response fields. API paths and fields can change, so do not copy an undated endpoint into a long-lived integration.

Routing results are observations of BGP data. They answer a different question from a registry record and may change as announcements change.

Method 3: Cross-check with Team Cymru

Team Cymru provides an independent IP-to-ASN lookup. It supports both IPv4 and IPv6, but a query may contain only one address family. Select IPv4 or IPv6, submit the address, and record the returned ASN and network information.

Use this check when a registry result and a routing result disagree, or when you need a second independent source before acting on the data.

Command-line workflow for repeatable investigations

#!/usr/bin/env bash
set -euo pipefail

IP="${1:?usage: $0 IP_ADDRESS}"

python3 - <<'PY' "$IP"
import ipaddress
import json
import sys
import urllib.request

ip = sys.argv[1]
ipaddress.ip_address(ip)
url = f"https://rdap.arin.net/registry/ip/{ip}"
request = urllib.request.Request(url, headers={"Accept": "application/rdap+json"})
with urllib.request.urlopen(request, timeout=20) as response:
    data = json.load(response)
print(json.dumps({
    "query_ip": ip,
    "network_name": data.get("name"),
    "network_handle": data.get("handle"),
    "start_address": data.get("startAddress"),
    "end_address": data.get("endAddress"),
}, indent=2))
PY

For an audit trail, store the query IP, UTC timestamp, source, raw response, and the parsed ASN or network fields. Retaining the raw response lets you explain later why an answer changed.

Why ASN lookup services disagree

Two correct services can return different answers because they expose different datasets:

A repeatable lookup records the IP, source, timestamp, and raw response.
A repeatable lookup records the IP, source, timestamp, and raw response.
  • Registration versus routing: RDAP records the organization or network associated with an address block. BGP data reports an ASN observed originating or announcing a route.
  • Transit: A provider can carry traffic for another network, so the visible route and the registered holder are different.
  • Reassignment: An address range can be reassigned while older registration details, cached data, or related objects remain visible.
  • More-specific routes: A smaller prefix can be announced by a different ASN than its covering allocation.
  • Timing: BGP state changes quickly. A registry record changes on a different schedule.
  • Address-family or scope differences: IPv4 and IPv6 are separate queries, and some tools expose only a selected view of routing data.

State the operational question in your report: “registered network,” “current BGP origin,” or “historical origin.” Then cite the source and timestamp.

Validation checklist

  • Validate that the input is a syntactically valid IPv4 or IPv6 address.
  • Query the registry responsible for the address region when ARIN is not authoritative.
  • Compare at least one registration source with one routing source for security or outage decisions.
  • Check whether the result contains one origin ASN or a set of origins.
  • Save raw JSON and timestamps for investigations that must be reproduced.
  • Do not infer ownership of a person or company solely from an ASN; an ASN identifies a network and its routing or registration context.

Troubleshooting

Symptom Likely cause Fix
RDAP returns 400 or an empty result Malformed IP, extra whitespace, or an unsupported path Trim the value, validate it with an IP parser, and use /registry/ip/<IP-address>.
IPv6 request fails Colons were altered, URL-encoded incorrectly, or the wrong address family was selected Pass the literal IPv6 address to the RDAP path and select IPv6 in Team Cymru.
ARIN shows a network but no obvious ASN Registration data does not always expose the currently originating ASN Use RIPEstat or another routing-data source for the BGP origin.
RIPEstat and ARIN disagree They answer routing and registration questions respectively Record both labels and timestamps; check for transit, reassignment, or more-specific announcements.
Script times out Network policy, transient service failure, or an overly short timeout Use a bounded timeout, retry a small number of times with backoff, and retain the failed query for review.
Team Cymru rejects a batch The query mixes IPv4 and IPv6 Send one address family per query.
JSON parsing fails An intermediary returned HTML or a rate-limit response Check the HTTP status and Content-Type before parsing; log the response body safely.

Performance, reliability, and cost

For occasional checks, a browser lookup is simplest. For bulk work, parallelize cautiously, cache results for a defined period, and preserve the source timestamp. Registry and routing data have different freshness characteristics, so a cached answer should never be presented as current without its age.

Public lookup services solve this task without dedicated hardware or paid desktop software. Respect each service’s published usage guidance, apply retries only to transient failures, and avoid treating a timeout as proof that an IP has no ASN.

Or skip the browser setup

If your workflow also needs a rendered screenshot of an IP intelligence page, ScreenshotNeo provides a single GET request that returns PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API documentation for all options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Create a free ScreenshotNeo account to try it.

FAQ

Is an ASN the same as an IP address?

No. An IP address identifies an interface or network address; an ASN identifies an autonomous system that participates in routing.

Can one IP address have more than one ASN?

Yes. Different routes, more-specific announcements, time periods, or data sources can associate an address with different origins. Report the scope and timestamp.

Should I trust ARIN or RIPEstat when they conflict?

Use ARIN/RDAP for registration ownership context and RIPEstat for observed routing context. Neither automatically replaces the other.

Does an ASN lookup reveal the person using an IP?

No. It generally identifies network registration or routing information, not an individual subscriber.

How should I store lookup results?

Store the input IP, UTC time, source, raw response, parsed ASN, and the interpretation you applied. This is essential when investigating changing BGP state.