Subnet / CIDR Calculator
Subnet / CIDR Calculator
Enter an IPv4 address and its CIDR prefix length (like /24) to calculate the subnet mask, network address, broadcast address, total and usable host counts, and the first/last usable host addresses in the range.
The prefix length directly determines how many addresses the subnet contains: /24 is the classic "Class C" size with 256 total addresses (254 usable, after reserving the network and broadcast addresses), while /30 leaves room for only 2 usable hosts — exactly enough for a point-to-point link between two routers. Understanding this math is a basic but essential skill for network engineers planning IP address allocation, and getting it wrong (allocating a subnet too small, or overlapping two subnets) is one of the more common networking mistakes this calculator helps catch before deployment.
- Formula: Total Addresses = 2^(32 − Prefix Length); Usable Hosts = Total − 2 (subtracting the network and broadcast addresses).
- Common prefix lengths: /24 (256 addresses, 254 usable) is the classic "Class C" home/office network size; /8, /16, and /30 (point-to-point links, only 2 usable hosts) are also common.
- IPv4 only: this calculator handles IPv4 CIDR notation (e.g. 192.168.1.0/24); IPv6 uses a similar but much larger addressing scheme not covered here.
Why are 2 addresses unusable in every subnet?
The first address in the range is reserved as the network address (identifying the subnet itself), and the last is reserved as the broadcast address (used to send to every host on the subnet at once).
What subnet size do I need for N devices?
Find the smallest power of 2 that is at least N+2 (for network and broadcast), then take log₂ of that and subtract from 32 to get the prefix length — e.g. for 50 devices, 64 (2⁶) is the smallest sufficient block, giving a /26.
Subnet / CIDR Calculator


Enter an IPv4 address and its CIDR prefix length (like /24) to calculate the subnet mask, network address, broadcast address, total and usable host counts, and the first/last usable host addresses in the range.
The prefix length directly determines how many addresses the subnet contains: /24 is the classic "Class C" size with 256 total addresses (254 usable, after reserving the network and broadcast addresses), while /30 leaves room for only 2 usable hosts — exactly enough for a point-to-point link between two routers. Understanding this math is a basic but essential skill for network engineers planning IP address allocation, and getting it wrong (allocating a subnet too small, or overlapping two subnets) is one of the more common networking mistakes this calculator helps catch before deployment.

- Formula: Total Addresses = 2^(32 − Prefix Length); Usable Hosts = Total − 2 (subtracting the network and broadcast addresses).
- Common prefix lengths: /24 (256 addresses, 254 usable) is the classic "Class C" home/office network size; /8, /16, and /30 (point-to-point links, only 2 usable hosts) are also common.
- IPv4 only: this calculator handles IPv4 CIDR notation (e.g. 192.168.1.0/24); IPv6 uses a similar but much larger addressing scheme not covered here.
Why are 2 addresses unusable in every subnet?
The first address in the range is reserved as the network address (identifying the subnet itself), and the last is reserved as the broadcast address (used to send to every host on the subnet at once).
What subnet size do I need for N devices?
Find the smallest power of 2 that is at least N+2 (for network and broadcast), then take log₂ of that and subtract from 32 to get the prefix length — e.g. for 50 devices, 64 (2⁶) is the smallest sufficient block, giving a /26.
