Skip to content
ipcalc.net/API Documentation

Free developer REST API

Programmatic IP & subnet API.

Integrate high-speed IP subnetting, CIDR calculations, wildcard masks, and visitor IP detection into your shell scripts, CI/CD pipelines, Ansible playbooks, and applications.

Zero Authentication

No API keys or signup required. Free for personal, commercial, and automation use.

Global Edge Speed

Responses dispatched in single-digit milliseconds with global anycast CDN caching.

CORS Enabled

Headers configured with Access-Control-Allow-Origin: * for seamless client-side fetch.

GET/api/subnet
Test in Browser

Calculates complete network boundaries, broadcast addresses, usable host capacity, Cisco configs, and binary representation for any IPv4 address with CIDR prefix or netmask.

Query Parameters

ParameterTypeDescriptionExample
qstringFull CIDR string or IP address with prefix length.192.168.1.1/24
ipstringIndividual IPv4 address (used alongside mask/prefix).10.0.0.1
mask / prefixstring/numberDotted-decimal mask or integer prefix (0-32).255.255.255.0 or 24

Usage Snippets

# Shell / cURL
curl -s "https://ipcalc.net/api/subnet?q=192.168.1.1/24" | jq .
// JavaScript / TypeScript Fetch
const res = await fetch('https://ipcalc.net/api/subnet?q=10.0.0.1/16'); const data = await res.json(); console.log(`Usable Hosts: ${data.usableHostCount}`);
# Python requests
import requests resp = requests.get('https://ipcalc.net/api/subnet', params={'q': '172.16.0.1/20'}) data = resp.json() print("Network:", data['networkAddress'], "Mask:", data['netmask'])

Sample Response (200 OK)

{
  "ip": "192.168.1.1",
  "cidr": 24,
  "netmask": "255.255.255.0",
  "wildcard": "0.0.0.255",
  "networkAddress": "192.168.1.0",
  "broadcastAddress": "192.168.1.255",
  "firstUsableIp": "192.168.1.1",
  "lastUsableIp": "192.168.1.254",
  "usableHostCount": 254,
  "totalIpCount": 256,
  "ipClass": "C",
  "ipScope": "Private (RFC 1918)",
  "binaryIp": "11000000.10101000.00000001.00000001",
  "binaryNetmask": "11111111.11111111.11111111.00000000",
  "hexIp": "0xC0A80101",
  "hexNetmask": "0xFFFFFF00",
  "integerIp": 3232235777,
  "reverseDns": "1.1.168.192.in-addr.arpa",
  "ciscoConfig": "ip address 192.168.1.1 255.255.255.0",
  "ciscoAcl": "192.168.1.0 0.0.0.255",
  "isRfc3021": false,
  "isHostRoute": false
}
GET/api/my-ip
Test in Browser

Returns the requesting client's public IPv4/IPv6 address and edge point-of-presence code. Ideal for IP discovery in bash scripts and remote debugging.

cURL Example

curl -s https://ipcalc.net/api/my-ip

Sample Response (200 OK)

{
  "ip": "203.0.113.195",
  "colo": "IAD"
}