Free IP to Autonomous System Number Lookup Service
IP2ASN is a free service that maps IP addresses (both IPv4 and IPv6) to their origin Autonomous System Numbers (ASNs). An Autonomous System is a collection of IP networks and routers under the control of a single organization that presents a common routing policy to the internet.
Simple JSON API with no authentication required. Perfect for scripts and automation.
Model Context Protocol server for AI assistants to perform IP lookups programmatically.
Queries live BGP routing data for accurate, up-to-date results.
Enter an IP address to look up its origin ASN
GET /json?ip=<address>
| Parameter | Type | Required | Description |
|---|---|---|---|
ip |
string | Yes | IPv4 or IPv6 address to lookup |
Successful response (HTTP 200):
{
"origins": [15169]
}
The origins array contains the unique ASNs found in the BGP routing table for the given IP
address. Multiple ASNs may be returned if the IP is multi-homed.
| Status Code | Description |
|---|---|
| 400 | Invalid IP address format |
| 451 | IP address is in private/reserved/multicast range |
| 500 | Backend lookup failed or timeout |
curl https://ip2asn.net/json?ip=8.8.8.8
import requests
response = requests.get('https://ip2asn.net/json?ip=8.8.8.8')
data = response.json()
print(f"ASNs: {data['origins']}")
fetch('https://ip2asn.net/json?ip=8.8.8.8')
.then(response => response.json())
.then(data => console.log('ASNs:', data.origins));
resp, err := http.Get("https://ip2asn.net/json?ip=8.8.8.8")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result struct {
Origins []int `json:"origins"`
}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println("ASNs:", result.Origins)
The service includes a Model Context Protocol (MCP) server at /mcp that exposes IP-to-ASN
lookup functionality to AI assistants and other MCP clients.
lookup_asn - Look up origin AS numbers for an IP addressip2asn://metrics - Service metrics information{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "lookup_asn",
"arguments": {
"ip": "8.8.8.8"
}
}
}
The MCP server follows the Model Context Protocol specification and supports initialize, tools/list, tools/call, resources/list, and resources/read methods.
/health - Health check endpointReal-time service statistics: