Subnetting and IPv4 Fundamentals
A practical guide to IPv4 subnetting that keeps CIDR, subnet masks, wildcard masks, host counts, and network boundaries tied to the same binary model so the results stay intuitive instead of feeling like memorised lookups.
Key formulas
For ordinary subnets, subtract network and broadcast addresses.
The remaining bits are available for hosts or further subnetting.
A useful quick method once the interesting octet is identified.
Common in ACL-style matching and summarised policy rules.
Subnetting is binary place value applied to addresses
IPv4 subnetting becomes much easier when you stop treating the mask as a magic decimal pattern and start treating it as a count of network bits. A prefix such as /24 means the first 24 bits define the network and the remaining bits define the host portion within that network.
Once you view the address and mask in binary, network address, broadcast address, host range, and block boundaries all become consequences of the same rule rather than separate memorisation tasks.
CIDR and subnet masks describe the same boundary in different forms
CIDR notation tells you how many leading bits are fixed as network bits. The dotted-decimal subnet mask shows the same thing in octet form. Converting between /27 and 255.255.255.224, for example, is not a separate concept; it is the same boundary expressed differently.
That is why the related calculators belong together. One helps when the prefix is already known, another when the dotted-decimal form is on the page, and another when you want wildcard output for policy or ACL work.
Network, broadcast, and usable host range
Within a conventional IPv4 subnet, the all-zero host pattern is the network address and the all-one host pattern is the broadcast address. The usable host range sits between them. The host-count formula 2^(host bits) - 2 is simply another way of saying that those two special patterns are reserved in normal subnetting.
This is also why smaller prefixes can create surprisingly small usable ranges. A /30 leaves only two usable addresses, which is perfect for a point-to-point link but poor for a user LAN.
Worked example: 192.168.10.34/27
A /27 leaves 5 host bits, so each subnet has 32 total addresses and 30 usable hosts. The dotted mask is 255.255.255.224, which means the block size in the final octet is 32. The subnet ranges therefore begin at .0, .32, .64, and so on.
Address 192.168.10.34 falls inside the 192.168.10.32/27 block. The network address is 192.168.10.32, the broadcast address is 192.168.10.63, and the usable range is 192.168.10.33 to 192.168.10.62.
Worked example: planning subnets from host requirements
If a site needs roughly 50 usable addresses on a segment, /27 is too small because it offers only 30 usable hosts. /26 offers 62 usable hosts and is the first common prefix that fits with headroom. The design question is therefore not only 'what is the current address?' but also 'which prefix gives enough growth without wasting the plan?'
Subnetting becomes much more practical when you design from requirements outward instead of only decoding existing addresses.
Wildcard masks and why they matter
Wildcard masks are often used in access control and matching rules. They are the inverse of the subnet mask, which means they highlight which bits are allowed to vary. The arithmetic is simple, but the context matters: wildcard notation is about matching patterns, not about defining a routed subnet boundary.
Keeping wildcard masks mentally separate from subnet masks prevents configuration mistakes where a valid routed subnet is confused with a rule-matching pattern.
Common mistakes in IPv4 subnetting
- Forgetting that CIDR length and dotted-decimal mask describe the same thing.
- Using the right block size but applying it in the wrong octet.
- Counting the network and broadcast addresses as usable in ordinary host ranges.
- Mixing route summarisation logic with access-control wildcard logic.
- Choosing a prefix that technically fits today but leaves no operational headroom.
Apply the topic straight away.
IPv4 Network Calculator
Work out the network address, broadcast address, host range, and mask details for an IPv4 network from the address and prefix you enter.
CIDR from Subnet Mask Calculator
Use the CIDR from Subnet Mask Calculator to work out cidr from subnet mask for networking, storage, or systems planning.
Subnet Mask from CIDR Calculator
Use the Subnet Mask from CIDR Calculator to work out subnet mask from cidr for networking, storage, or systems planning.
Wildcard Mask from CIDR Calculator
Use the Wildcard Mask from CIDR Calculator to work out wildcard mask from cidr for networking, storage, or systems planning.
Subnet Host Count Calculator
Use the Subnet Host Count Calculator to work out subnet host count for networking, storage, or systems planning.