IP Subnet / CIDR Calculator
IP Subnet / CIDR is evaluated from CIDR Prefix Length. The calculation reports Subnet Mask, Total Addresses and Usable Host Addresses.
Results
About the IP Subnet / CIDR Calculator
The calculator uses a multi formula configuration. Each reported value is read as a direct evaluation of the stored rules with the declared field formats and units.
Formula basis:
Total IPs = 2^(32 - prefix_length)
Usable hosts = Total - 2
Subnet mask: first prefix bits = 1, remainder = 0
Interpret the outputs in the order shown by the result fields. Optional inputs affect only the outputs that depend on those variables.
Formula & How It Works
The calculation applies the following relations exactly as recorded in the metadata: Total IPs = 2^(32 - prefix_length) Usable hosts = Total - 2 Subnet mask: first prefix bits = 1, remainder = 0 Each output field is produced by substituting the supplied inputs into the relevant relation and then applying the declared rounding or text format.
Worked Examples
Example 1: /24 network — typical home/small office subnet
Inputs
With CIDR Prefix Length = 24 as the stated inputs, the result is Subnet Mask = 255.255.255.0, Total Addresses = 256 and Usable Host Addresses = 254. Each value corresponds to the declared output fields.
Example 2: /16 network — medium enterprise
Inputs
With CIDR Prefix Length = 16 as the stated inputs, the result is Subnet Mask = 255.255.0.0, Total Addresses = 65,536 and Usable Host Addresses = 65,534. Each value corresponds to the declared output fields.
Example 3: /30 network — point-to-point link between routers
Inputs
With CIDR Prefix Length = 30 as the stated inputs, the result is Subnet Mask = 255.255.255.252, Total Addresses = 4 and Usable Host Addresses = 2. Each value corresponds to the declared output fields.
Example 4: /28 — small DMZ or IoT segment
Inputs
With CIDR Prefix Length = 28 as the stated inputs, the result is Subnet Mask = 255.255.255.240, Total Addresses = 16 and Usable Host Addresses = 14. Each value corresponds to the declared output fields.
Common Use Cases
- Calculate usable hosts in a subnet
- Find network and broadcast addresses
- Plan IP address allocation for a network