IPv4 CIDR Explained: /24, /27, /31 and /32

A concrete way to see where a subnet begins, where it ends and how many addresses it contains.

What does the CIDR number mean?

IPv4 has 32 address bits. A prefix such as /24 assigns 24 bits to the network portion, leaving 8 bits for addresses in that range. A prefix does not tell you which devices are connected; it only describes an address block mathematically.

For a /24, the block has 2^(32−24) = 256 addresses. Under conventional subnetting, the network and broadcast addresses are not assigned to ordinary hosts, leaving 254 host addresses.

Worked example 1: 192.168.1.100/24

With a /24 prefix, the first three octets define the network. The subnet mask is 255.255.255.0. The network address is 192.168.1.0 and the broadcast is 192.168.1.255. Typical usable host addresses run from 192.168.1.1 to 192.168.1.254.

Worked example 2: 10.20.30.45/27

A /27 leaves 5 host bits, meaning a block size of 2^5 = 32 addresses. The last-octet block boundaries are 0, 32, 64, 96, 128, 160, 192 and 224. Since 45 is between 32 and 63, the subnet is 10.20.30.32/27.

Subnet mask255.255.255.224
Network address10.20.30.32
Broadcast10.20.30.63
Usable hosts10.20.30.33 – 10.20.30.62 (30 addresses)

The same method works for other prefixes: divide the address space into blocks based on the number of remaining host bits.

Why /31 and /32 break the common host-count shortcut

The shortcut “total minus two” only describes many conventional LAN allocations. RFC 3021 permits both addresses of a /31 to be used on certain point-to-point links. A /32 identifies one exact IPv4 address, often used as a host route.

These special cases matter in routing and monitoring. They should not be presented as ordinary LAN address pools.

Where can the calculation mislead you?

Cloud platforms may reserve extra addresses; VLANs, routing policy and DHCP exclusions can reduce availability. The network arithmetic does not confirm which addresses are assigned, reachable, or permitted. Test the actual network configuration separately.

Calculate your own network

Try our IPv4 subnet calculator with 10.20.30.45/27 and compare every field to the worked example. Then change the prefix to /30 and observe how the range contracts.

Practice with an interactive tool

Use the examples above with our free utilities, right in your browser.

Explore all seven tools →