CIDR Subnet Calculator
Type an IPv4 address with a prefix length, such as 192.168.1.0/24, and click Calculate Subnet. The page shows the network address, broadcast address, subnet mask, wildcard mask, first and last usable IP, total addresses, and usable hosts. It also lays the IP, mask, and network address out in binary, and labels the legacy address class (A to E) and the network type, such as RFC 1918 private or loopback. Any address inside the block works as input, not only the base address.
How to calculate a CIDR range
- Type an address and prefix into IP Address with CIDR, for example
172.16.40.9/20, then click Calculate Subnet or press Enter. The field starts with 192.168.1.0/24 and is calculated on page load. - Read Network Information: network address, broadcast address, subnet mask, wildcard mask (the inverse of the mask, as used in Cisco-style access lists), first and last usable IP, total addresses, and usable hosts.
- Open Binary Breakdown to compare the IP, the mask, and the resulting network address bit by bit. The network row is the IP ANDed with the mask.
- Check Classification for the IP class, the network type, and the prefix. If the input is not four octets plus a prefix from 0 to 32, a red message says what is wrong.
Why the network address is an AND and usable hosts are two fewer
A prefix of /N means the first N bits identify the network and the remaining 32 minus N bits identify the host. ANDing the address with the mask zeroes the host bits and gives the network address. ORing the network address with the inverted mask (the wildcard) sets every host bit and gives the broadcast address. A /20 leaves 12 host bits, so the block holds 4,096 addresses.
By convention the first address in a block names the subnet and the last is the broadcast, so usable hosts are total addresses minus 2, which gives a /8 its 16,777,214. This page applies that rule at every size, and it breaks at the two smallest. A /31 point-to-point link uses both addresses as hosts (RFC 3021) and a /32 is a single host route, but here both report 0 usable hosts and a first usable IP above the last. For those prefixes use the IPv4 Subnet Calculator, which handles them.
The class label comes from the first octet: A is 1 to 126, B is 128 to 191, C is 192 to 223, D is multicast, and E is reserved. Classful addressing was replaced by CIDR in the 1990s, so the class says nothing about the real prefix. Network Type recognizes only RFC 1918 private ranges, loopback, link-local, and multicast, and labels everything else Public, so shared space such as 100.64.0.0/10 also reads as Public.