One lookup for a whole subnet

Configuring a router interface, a DHCP scope or a cloud subnet usually needs several numbers at once: where the block begins, where it ends, how many addresses it holds and how many can go to hosts. Enter a dotted-decimal address and a prefix length, and this page returns all four. The default, 192.168.1.130 with a prefix of 26, gives the network 192.168.1.128, the last address 192.168.1.191, 64 total addresses and 62 usable hosts. Any address inside the block produces the same answers for the same prefix, so you can start from whichever host address you have on hand. Starting from a host address saves the extra step of working out the network address first.

Splitting 32 bits into network and host parts

The prefix divides the 32 bits into network and host parts. The mask is the top p bits set to one. The network address is the address ANDed with that mask, which clears the host bits. The block holds 2^(32 − p) addresses, and the last address is the network address plus that count minus one, which is the same as setting every host bit. For the default, 32 − 26 = 6 host bits, so the block holds 2^6 = 64 addresses. Starting from .128, adding 63 gives .191. Usable hosts are 64 − 2 = 62, because the first address names the network and the last is the conventional broadcast. To check the arithmetic, confirm that the network address plus the block size lands on the first address of the next block, here 192.168.1.192.

Sizing a subnet for a number of hosts

To size a subnet, add two to the number of hosts you need and round up to the next power of two. A department with 50 devices needs 52 addresses, which rounds to 64, so the prefix is /26 and 62 are usable, leaving 12 spare. A server segment with 120 devices needs 122, which rounds to 128, so /25, with 126 usable. A /24 holds 256 addresses and 254 usable. Entering 10.0.5.77 with a prefix of 24 returns the network 10.0.5.0, the last address 10.0.5.255, 256 total and 254 usable. Leave room for growth, since renumbering a subnet later is disruptive.

Larger and smaller blocks

Block size doubles with each bit removed from the prefix. A /30 has 4 addresses and 2 usable, common on router-to-router links. For 198.51.100.5/30 the network is 198.51.100.4 and the last address is 198.51.100.7. A /22 has 1,024 addresses and 1,022 usable. For 10.10.9.9/22 the network is 10.10.8.0 and the last address is 10.10.11.255. A /20 holds 4,096 addresses and 4,094 usable. For 172.16.37.200/20 the network is 172.16.32.0 and the last is 172.16.47.255. A /8 holds 16,777,216 addresses, with 16,777,214 usable. The pattern lets you check any output against a quick mental estimate.

The special cases of /31 and /32

The total-minus-two rule applies only to /0 through /30. A /32 is one address, with no subnet around it. A /31 holds two addresses, and RFC 3021 lets both serve as host addresses on a point-to-point link, because such a link needs no network or broadcast address. Entering 203.0.113.9 with a prefix of 31 returns the network 203.0.113.8, the last address 203.0.113.9 and 2 total addresses. Whether your equipment supports the RFC 3021 treatment is something to check, since older devices assume the conventional rule. The page follows the convention described in its assumptions and handles these two prefixes as explicit exceptions, not as ordinary subnets.

How the prefix is chosen in practice

Operators tend to pick prefixes that match an address plan, not individual host counts. Branch offices might each get a /24, point-to-point links a /30 or /31, and loopback addresses a /32. Private networks follow RFC 1918, which reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Using a calculator to check each block before it goes into a plan prevents overlaps and misaligned boundaries. A block must start at a multiple of its own size, so a /26 can begin at .0, .64, .128 or .192 and nowhere else. If a result shows a network address you did not expect, the host address and prefix you entered likely describe a different block than you intended. Overlaps are easy to spot once each block is written as a first and last address, because two blocks overlap only if their ranges share an address.

Reading a /26 as 26 hosts

The most frequent mistake is reading the prefix as a number of hosts. A /26 is 26 network bits, not 26 hosts. Another is forgetting the two reserved addresses and promising 64 hosts on a /26. A third is entering a host address and assuming the network address ends in zero, which is true only on octet boundaries. Mixing masks and prefixes also causes errors, so convert 255.255.255.192 to /26 before use. Finally, do not assign the network or the last address to a device in a conventional subnet. Doing so can make routing or ARP fail in ways that are hard to trace. A further trap is expecting the page to reject a host address that is not the network address. It will not, because any address inside the block is accepted and masked down.

Reading the output in context

The address counts describe the chosen block. They do not establish that the addresses are routable on the public internet, that your provider assigned them to you, or that they are free. Cloud platforms often reserve several addresses in each subnet for gateways, DNS and internal services, so the usable count is lower than the conventional figure. Before relying on a number for capacity planning, read the platform documentation. Also check for overlap with other networks, particularly across VPN links and peered networks, where two sites that both chose 192.168.1.0/24 cannot be joined without renumbering or translation.

Limits and sources

The input must be a strict dotted-decimal IPv4 address and an integer prefix from 0 to 32. The calculator covers one block at a time. It does not split a block into subnets, summarize several blocks into one, or handle IPv6. The notation and masking rules follow classless inter-domain routing as specified in RFC 4632, and the /31 treatment follows RFC 3021. For splitting a block into equal parts, use the IPv4 subnet split calculator, and for broadcast or network values alone, the focused lookup pages on this site give the same figures.