IP Subnet Calculator
Enter an IP address and CIDR prefix to find the network address, broadcast address, subnet mask, and usable host count.
Enter four whole decimal octets from 0 to 255 and a whole CIDR prefix from 0 to 32.
For /0–/30, host counts exclude the network and broadcast endpoints. A /31 uses both addresses for a point-to-point link; /32 represents one address. The highest-address result is shown for every prefix, but /31 and /32 have no separate directed broadcast. Historical classes do not determine a CIDR mask or whether an address is routable.
How subnet calculations work
The CIDR prefix (like /24) indicates how many leading bits of the 32-bit IP address are fixed as the network portion, with the rest available for host addresses. The subnet mask is the corresponding pattern of 1s and 0s expressed in dotted-decimal form (like 255.255.255.0 for /24).
For /0–/30, host counts exclude the network and broadcast endpoints. A /31 uses both addresses for a point-to-point link; /32 represents one address. The highest-address result is shown for every prefix, but /31 and /32 have no separate directed broadcast. Historical classes do not determine a CIDR mask or whether an address is routable.
Frequently asked questions
What does a /24 subnet mean?
A /24 means the first 24 bits of the IP address are the network portion, leaving 8 bits (256 addresses) for hosts — though 2 of those are reserved for the network and broadcast addresses, leaving 254 usable host addresses.
Why are the network and broadcast addresses not usable for hosts?
For /0–/30, host counts exclude the network and broadcast endpoints. A /31 uses both addresses for a point-to-point link; /32 represents one address. The highest-address result is shown for every prefix, but /31 and /32 have no separate directed broadcast. Historical classes do not determine a CIDR mask or whether an address is routable.
What happens with a /31 or /32 prefix?
A /32 identifies a single specific address with no room for a network/broadcast distinction. A /31 is a special case (defined in RFC 3021) commonly used for point-to-point links, where both addresses in the 2-address range are usable as host addresses rather than reserved.
How we verified this calculator
The calculator is checked against 6 reference cases computed independently of its code. Last passed: .
| # | Inputs | Expected result |
|---|---|---|
| 1 |
IP address = 0.0.0.0
CIDR prefix = 0
|
Network address: 0.0.0.0
Broadcast address: 255.255.255.255
Subnet mask: 0.0.0.0
Usable hosts: 4294967294
|
| 2 |
IP address = 0.0.0.0
CIDR prefix = 1
|
Network address: 0.0.0.0
Broadcast address: 127.255.255.255
Subnet mask: 128.0.0.0
Usable hosts: 2147483646
|
| 3 |
IP address = 0.0.0.0
CIDR prefix = 2
|
Network address: 0.0.0.0
Broadcast address: 63.255.255.255
Subnet mask: 192.0.0.0
Usable hosts: 1073741822
|
| 4 |
IP address = 0.0.0.0
CIDR prefix = 3
|
Network address: 0.0.0.0
Broadcast address: 31.255.255.255
Subnet mask: 224.0.0.0
Usable hosts: 536870910
|
| 5 |
IP address = 0.0.0.0
CIDR prefix = 4
|
Network address: 0.0.0.0
Broadcast address: 15.255.255.255
Subnet mask: 240.0.0.0
Usable hosts: 268435454
|
| 6 |
IP address = 0.0.0.0
CIDR prefix = 5
|
Network address: 0.0.0.0
Broadcast address: 7.255.255.255
Subnet mask: 248.0.0.0
Usable hosts: 134217726
|