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.
No API keys or signup required. Free for personal, commercial, and automation use.
Responses dispatched in single-digit milliseconds with global anycast CDN caching.
Headers configured with Access-Control-Allow-Origin: * for seamless client-side fetch.
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
| Parameter | Type | Description | Example |
|---|---|---|---|
| q | string | Full CIDR string or IP address with prefix length. | 192.168.1.1/24 |
| ip | string | Individual IPv4 address (used alongside mask/prefix). | 10.0.0.1 |
| mask / prefix | string/number | Dotted-decimal mask or integer prefix (0-32). | 255.255.255.0 or 24 |
Usage Snippets
curl -s "https://ipcalc.net/api/subnet?q=192.168.1.1/24" | jq .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}`);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
}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-ipSample Response (200 OK)
{
"ip": "203.0.113.195",
"colo": "IAD"
}Related tools and guides
- IP Subnet CalculatorIPv4 network, broadcast and host range from any IP and mask.
- CIDR CalculatorConvert CIDR notation to masks, ranges and host counts.
- What Is My IP Address?See your public IP and look up any address.
- IP Range CalculatorTurn a start/end IP range into the minimum CIDR blocks.
- Subnet Mask CalculatorSubnet mask to CIDR and back, with a full mask list.