About the Subnet Calculator API

API Version: 1.9

The Subnet Calculator allows you to determine network details for an IPv4 subnet, given an address in dotted-decimal notation (w.x.y.z) or CIDR notation (w.x.y.z/s).

This is the API for the Subnet Calculator.

See also: Subnets API

Endpoints

GET
https://networkcalc.com/api/ip/{subnet}

Calculate subnets

. Calculates the details for a subnet, specified as an IPv4 address or CIDR block.

Parameters

{subnet}

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 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.

Response Formats

SubnetResponse

{
  "status": "[string] The status of the request.",
  "meta": {
    "permalink": "[string] A hyperlink to the browser results (API permalink) for the subnet.",
    "next_address": "[string] The IP address sequentially following the one requested. Useful for iterating."
  },
  "address": {
    "cidr_notation": "[string] The requested address in CIDR notation, per RFC 4632.",
    "subnet_bits": "[number] The number of bits representing the subnet mask.",
    "subnet_mask": "[string] The subnet mask in dotted-decimal notation.",
    "wildcard_mask": "[string] The wildcard (inverted subnet) mask in dotted-decimal notation.",
    "network_address": "[string] The network ID for the subnet (first address in the subnet; unassignable).",
    "broadcast_address": "[string] The broadcast address for the subnet (last address in the subnet; unassignable).",
    "assignable_hosts": "[number] The number of assignable hosts in the subnet.",
    "first_assignable_host": "[string] The IP address representing the first assignable host or null.",
    "last_assignable_host": "[string] The IP address representing the last assignable host or null.",
    "binary": "[Object] (Optional) See SubnetAddressBinary"
  }
}

SubnetAddressBinary

{
  "octet_1": "[string] Binary representation of the first octet of the requested address.",
  "octet_2": "[string] Binary representation of the second octet of the requested address.",
  "octet_3": "[string] Binary representation of the third octet of the requested address.",
  "octet_4": "[string] Binary representation of the fourth octet of the requested address.",
  "address": "[string] Binary representation of the requested address.",
  "subnet_mask": "[string]",
  "wildcard_mask": "[string]",
  "network_address": "[string]",
  "broadcast_address": "[string]",
  "first_assignable_host": "[string]",
  "last_assignable_host": "[string]"
}