How this subnet calculator works
Every IPv4 address is really a 32-bit number split into four 8-bit octets, such as 192.168.1.10. A subnet groups a range of those addresses together. The CIDR prefix — the number after the slash — says how many leading bits belong to the network; the rest belong to the hosts inside that network.
The calculator converts your IP to a single 32-bit unsigned integer and builds a subnet mask from the prefix (the first n bits set to 1). It then does the bitwise math: the network address is the IP AND the mask (all host bits cleared), and the broadcast address is the network OR the wildcard mask (all host bits set). The first and last usable hosts sit just inside those two boundaries.
Special cases: a /31 has just 2 addresses and, per RFC 3021, both are usable on point-to-point links — so this tool reports 2 usable. A /32 is a single host address with 1 address and 0 usable hosts in the conventional sense.
Common CIDR prefixes
| CIDR | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
Frequently asked questions
- What is a subnet mask?
- A subnet mask is a 32-bit value that splits an IPv4 address into a network part and a host part. Bits set to 1 mark the network; bits set to 0 mark the hosts. A mask of 255.255.255.0 has 24 network bits — the same as a /24 prefix.
- What does /24 mean (CIDR)?
- In CIDR notation the number after the slash is the prefix length: the count of leading bits used for the network. /24 means the first 24 bits are the network, leaving 8 bits for hosts — 256 total addresses and 254 usable hosts.
- How many hosts are in a /24 or /16?
- A /24 has 256 addresses and 254 usable hosts. A /16 has 65,536 addresses and 65,534 usable hosts. In general, usable hosts = 2^(32 − prefix) − 2.
- What is the difference between the network and broadcast address?
- The network address is the first address in the block (all host bits 0) and names the subnet. The broadcast address is the last address (all host bits 1) and reaches every host at once. Neither is assigned to a host, so both are excluded from the usable range.
- What are the private IP ranges?
- RFC 1918 reserves three private ranges not routed on the public internet: 10.0.0.0/8 (10.x), 172.16.0.0/12 (172.16.x to 172.31.x) and 192.168.0.0/16 (192.168.x). They are used for internal networks behind NAT.
- How do I calculate a subnet?
- Convert the IP to a 32-bit number, build the mask from the prefix, then AND the IP with the mask for the network address. The broadcast is the network OR the wildcard (inverted mask). Usable hosts = 2^(32 − prefix) − 2.