How subnetting actually works
A prefix length splits an address into a network part and a host part. Everything else follows from that one idea.
An IPv4 address is 32 bits. A prefix length says how many of those leading bits identify the network; the remainder identify a host inside it. A /24 means 24 network bits and 8 host bits, so there are 28 = 256 addresses in the subnet.
Step-by-step
- Enter an address and a prefix length — or a subnet mask, which says the same thing differently.
- Read the network and broadcast, which are the first and last addresses.
- Read the usable range, which is what you can actually assign.
Why usable is usually size minus two
The first address in a subnet identifies the network itself and the last is the broadcast address. Neither can be assigned to a host, so a /24 holds 256 addresses and 254 usable ones.
That rule holds from /0 down to /30. It stops holding at the bottom, and the exceptions matter because they are the ones you meet on real equipment.
The /31 and /32 exceptions
A /31 has two usable addresses. RFC 3021 defines it as a point-to-point link where there are only two ends and no need for a broadcast address, so both addresses are usable. Many calculators report zero usable for a /31, which disagrees with the routers people configure. Using a /30 for a point-to-point link instead wastes half the block.
A /32 is a single host route. One address, usable. It turns up constantly in loopback interfaces and routing tables.
IPv6 does not work this way
IPv6 has no broadcast address at all — it uses multicast instead. So there is nothing to subtract, and every address in an IPv6 prefix is usable. Subtracting two from an IPv6 subnet is an IPv4 habit applied where it does not belong.
Masks and wildcards
A subnet mask expresses the same thing as a prefix length: 255.255.255.0 is /24. It must be a contiguous run of ones followed by zeros. Something like 255.255.0.255 is not a mask, and a tool that accepts it is giving you a confident wrong answer.
A wildcard mask is the inverse, used by access lists on several platforms. A /24 has the wildcard 0.0.0.255 — the bits set to one are the ones allowed to vary.
Frequently asked questions
How many usable hosts are in a /26?
62. A /26 has 6 host bits, so 64 addresses, less the network and broadcast addresses.
Why do some calculators say a /31 has no usable addresses?
They apply the size-minus-two rule everywhere. RFC 3021 makes a /31 a point-to-point link with two usable addresses and no broadcast, which is how routers treat it.
What is the difference between a subnet mask and a wildcard mask?
They are inverses. A /24 is the mask 255.255.255.0 and the wildcard 0.0.0.255. Masks appear in interface configuration, wildcards in access lists.
Is my input sent anywhere?
No. Subnetting is arithmetic, and the calculator performs it in your browser with no network request at all.
Open the subnet calculator →