IPv4 Subnet Calculator (CIDR)
Work out network, broadcast and host range for any IPv4 CIDR block.
Use via API
Network, broadcast, mask, host range and host count for an IPv4 CIDR. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/subnet-calculator
curl https://pithlab.com/api/v1/tools/subnet-calculator \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"cidr":"10.0.5.70/26"}'About the Subnet Calculator
Calculate an IPv4 subnet from CIDR or a netmask: network, broadcast, host range, wildcard, binary and address type. Split networks into smaller subnets.
How to use the Subnet Calculator
- Type an address with a prefix, such as 192.168.1.10/24, or an address followed by a mask, such as 10.0.0.1 255.255.255.252.
- Alternatively type just the address and put the prefix or dotted mask in the Subnet mask field.
- Read the network, broadcast, usable host range, masks and binary forms, then copy the summary.
- To plan smaller networks, pick a longer prefix under Split into subnets to list every resulting subnet.
Examples
Input
192.168.1.10/24
Output
Address: 192.168.1.10 Network: 192.168.1.0/24 Netmask: 255.255.255.0 Wildcard: 0.0.0.255 Broadcast: 192.168.1.255 First host: 192.168.1.1 Last host: 192.168.1.254 Usable hosts: 254 Total addresses: 256 Class: C Type: Private network (RFC 1918)
Input
10.0.0.1 255.255.255.252
Output
Address: 10.0.0.1 Network: 10.0.0.0/30 Netmask: 255.255.255.252 Wildcard: 0.0.0.3 Broadcast: 10.0.0.3 First host: 10.0.0.1 Last host: 10.0.0.2 Usable hosts: 2 Total addresses: 4 Class: A Type: Private network (RFC 1918)
Input
203.0.113.5/31
Output
Address: 203.0.113.5 Network: 203.0.113.4/31 Netmask: 255.255.255.254 Wildcard: 0.0.0.1 Broadcast: None First host: 203.0.113.4 Last host: 203.0.113.5 Usable hosts: 2 Total addresses: 2 Class: C Type: Documentation, TEST-NET-3 (RFC 5737)
Frequently asked questions
Why are there two fewer usable hosts than addresses?
In a normal subnet the first address identifies the network and the last is the broadcast address, so neither can be given to a host. A /24 has 256 addresses and 254 usable hosts.
How are /31 and /32 handled?
A /31 is treated as a point-to-point link under RFC 3021, so both addresses are usable and there is no broadcast. A /32 is a single host route containing just one address.
What is a wildcard mask?
It is the inverse of the netmask, with ones where the host bits are. Cisco ACLs and OSPF configuration use it, so 255.255.255.0 becomes 0.0.0.255.
Why is 192.168.01.1 rejected?
Leading zeros are ambiguous: some systems read 010 as octal (8) and others as decimal (10). To avoid silently calculating the wrong network, each octet must be written without leading zeros.
Which address ranges are recognised as special?
Private RFC 1918 ranges, the 100.64.0.0/10 carrier-grade NAT space, loopback, link-local, multicast, the three documentation TEST-NET ranges, benchmarking and other reserved blocks from the IANA special-purpose registry. Anything else is shown as public.