Developer Guides

Subnet Mask Cheat Sheet: CIDR, Addresses, and Hosts

Convert common CIDR prefixes to subnet masks, total addresses, and traditional usable-host counts with worked IPv4 examples.

ONLINTools Editorial Team Updated Aug 2, 2026 10 min read

Developer reference

CIDR tells you how many bits belong to the network

IPv4 addresses contain 32 bits. A CIDR prefix such as /24 means the first 24 bits identify the network prefix and the remaining 8 bits are available inside that address block. A longer prefix creates a smaller block.

Total addresses in an IPv4 prefix

total addresses = 2^(32 − prefix length)

For a /24, eight bits remain: 2⁸ = 256 total addresses. In traditional multi-access subnetting, the network and broadcast addresses are not assigned to ordinary hosts, leaving 254 conventional usable host addresses.

Common IPv4 subnet mask cheat sheet

CIDRSubnet maskTotal addressesTraditional usable hosts
/20255.255.240.04,0964,094
/21255.255.248.02,0482,046
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242

Need the arithmetic and address boundaries for one specific prefix? See the focused walkthrough for calculating usable hosts in a /27 subnet.

Worked example: split a /24 into /26 networks

In the first block, the conventional network address is 192.168.10.0, the broadcast address is 192.168.10.63, and the ordinary host range is 192.168.10.1 through 192.168.10.62.

Why the “minus two” rule has exceptions

The table uses the traditional network-and-broadcast reservation for common IPv4 subnets. RFC 3021 defines /31 prefixes for point-to-point links, where both addresses can identify the two endpoints. A /32 identifies one IPv4 address or host route rather than a multi-address subnet.

Sources and further reading

  1. 1.RFC 4632: Classless Inter-domain Routing (CIDR) RFC Editor
  2. 2.RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links RFC Editor
  3. 3.RFC 1878: Variable Length Subnet Table For IPv4 RFC Editor