https://networkcalc.com/api/ip/{subnet}
Calculates the details for a subnet, specified as an IPv4 address or CIDR block.
curl https://networkcalc.com/api/ip/10.5.1.0/27?binary=true
{
"status": "OK",
"meta": {
"permalink": "https://networkcalc.com/ip/10.5.1.0/27?binary=1",
"next_address": "https://networkcalc.com/api/ip/10.5.1.1/27?binary=1"
},
"address": {
"cidr_notation": "10.5.1.0/27",
"subnet_bits": 27,
"subnet_mask": "255.255.255.224",
"wildcard_mask": "0.0.0.31",
"network_address": "10.5.1.0",
"broadcast_address": "10.5.1.31",
"assignable_hosts": 30,
"first_assignable_host": "10.5.1.1",
"last_assignable_host": "10.5.1.30",
"binary": {
"octet_1": "00001010",
"octet_2": "00000101",
"octet_3": "00000001",
"octet_4": "00000000",
"address": "00001010 00000101 00000001 00000000",
"subnet_mask": "11111111 11111111 11111111 11100000",
"wildcard_mask": "00000000 00000000 00000000 00011111",
"network_address": "00001010 00000101 00000001 00000000",
"broadcast_address": "00001010 00000101 00000001 00011111",
"first_assignable_host": "00001010 00000101 00000001 00000001",
"last_assignable_host": "00001010 00000101 00000001 00011110"
}
}
}
Parameters
{subnet}(Required) The requested IPv4 address or CIDR block to calculate. To calculate multiple subnets, use the format [subnet_1,subnet_2,...].
Example: https://networkcalc.com/api/ip/192.168.1.1/24
binary(Optional) include('a binary representation of the subnet in the response.
Values: 0,false,1,true
Example: https://networkcalc.com/api/ip/192.168.1.1/24?binary=true
fields(Optional) A comma-separated list of fields to include. By default, all available fields are included.
Response Format
Response Codes
200
OK - Success.400
NO_ADDRESS_SPECIFIED - The {subnet} parameter was not specified.400
INVALID_ADDRESS - the address or addresses specified as {subnet} are invalid.