About the Subnet / CIDR Calculator
This Subnet / CIDR Calculator takes an IPv4 address and a prefix length like /24 and works out everything about that network: where it starts and ends, its masks, and how many hosts it can hold. It is aimed at network admins, cloud engineers, and students learning IP addressing.
How it works
The IP address is converted to a 32-bit number. The prefix length says how many leading bits belong to the network, so /24 creates a mask of 24 ones followed by 8 zeros, which is 255.255.255.0. A bitwise AND of the IP and the mask gives the network address; setting all host bits to 1 gives the broadcast address. The wildcard mask is the inverse of the subnet mask.
Total addresses equals 2 raised to the number of host bits (32 minus the prefix). Usable hosts is that number minus 2, because the network and broadcast addresses cannot be assigned. For /31 and /32, the tool reports 0 usable hosts and shows the network and broadcast addresses as the first and last host.
How to use
- 1
Type an IPv4 address, such as 10.0.5.77, into the IP address field.
- 2
Enter the prefix length (0-32) in the CIDR prefix field.
- 3
Read the network, broadcast, mask, host range, and address counts in the result cards.
Worked examples
A typical home network
The default 192.168.1.0/24 LAN.
Finding the subnet of a host
Which /20 block does 10.0.5.77 belong to?
With 12 host bits, the third octet is masked with 240, so 5 rounds down to 0.
A point-to-point link
A small /30 between two routers.
Frequently asked questions
What's the difference between a /24 and a /16?+
A /24 has 256 addresses (254 usable), while a /16 has 65,536 (65,534 usable). The smaller the number after the slash, the larger the network.
Why are the network and broadcast addresses not usable?+
The first address identifies the subnet itself and the last is reserved for messages to every device on it, so neither is assigned to a single device.
What is a wildcard mask?+
It is the inverse of the subnet mask: 0 bits must match and 1 bits can be anything. For a /24, the subnet mask 255.255.255.0 becomes the wildcard 0.0.0.255. Cisco ACLs and OSPF use this form.
How do I convert a subnet mask to CIDR?+
Count the 1 bits in the mask. 255.255.255.0 has 24, so it is /24; 255.255.240.0 has 20, so it is /20.
Can I enter any IP inside the subnet?+
Yes. Enter any host address and prefix, and the calculator works out the network it belongs to and that network's full range.