Subnetting step by step: the binary method, the fast decimal method and planning from requirements
In short: Subnetting splits one IP network into smaller ones by moving the boundary between the network and host bits. The binary method shows exactly why answers are right: AND the address with the mask for the network, set the host bits to one for the broadcast. The decimal block-size method gives the same answers in seconds once you have practised.
What subnetting is and why we do it
An IPv4 address has a network part and a host part; the mask or prefix length (such as /24) says where the boundary sits. Subnetting moves that boundary to the right by borrowing host bits, turning one network into several smaller ones. Organisations subnet so that each VLAN, site or link gets its own network: broadcast domains stay small, addresses are not wasted, and firewalls and ACLs can apply rules per subnet. For any subnet, you should be able to answer five questions:
- What is the network address (the first address, all host bits 0)?
- What is the broadcast address (the last address, all host bits 1)?
- What is the first usable host (network + 1)?
- What is the last usable host (broadcast − 1)?
- How many usable hosts are there (2host bits − 2)?
The binary method
Take the host 192.168.50.173/28. A /28 means 28 network bits and 4 host bits, so the mask is 255.255.255.240. Only the last octet is interesting, because the first three are fully network bits.
| Item | Last octet in binary | Decimal |
|---|---|---|
| Host address | 1010 1101 | 173 |
| Mask | 1111 0000 | 240 |
| Network (AND, host bits 0) | 1010 0000 | 160 |
| Broadcast (host bits 1) | 1010 1111 | 175 |
So the subnet is 192.168.50.160/28, the broadcast is 192.168.50.175, usable hosts run from .161 to .174, and there are 24 − 2 = 14 of them. The binary method is slow but it always works, and it shows why the answer is correct. If binary is rusty, start with binary and hexadecimal for network engineers.
The fast decimal method
Once you trust the binary method, you can skip most of the bits. Find the interesting octet, the one where the mask is neither 255 nor 0. Subtract that mask octet from 256 to get the block size: subnets start at multiples of it. Then find which block the address falls into.
For 172.16.45.200/20 the mask is 255.255.240.0, the interesting octet is the third, and the block size is 16. Blocks in the third octet start at 0, 16, 32, 48 and so on; 45 falls in the block starting at 32. So the network is 172.16.32.0 and the broadcast is the last address before the next block, 172.16.47.255. Usable hosts run from 172.16.32.1 to 172.16.47.254, which is 212 − 2 = 4,094 hosts. A shorter, exam-style version of this method is in subnetting in your head.
Planning from requirements
At work you usually start from a need, not an address:
- "I need N subnets": borrow the smallest number of bits b where 2b is at least N. Six subnets from a /24 needs 3 bits (8 subnets), so use /27.
- "Each subnet needs H hosts": keep the smallest number of host bits h where 2h − 2 is at least H. Fifty hosts needs 6 host bits (62 usable), so use /26.
- Point-to-point links between routers need only two addresses. A /30 gives exactly two usable hosts, and many networks now use /31 on such links (RFC 3021), which has no network or broadcast address.
- Different sizes in one plan call for VLSM; see VLSM, CIDR and route summarisation.
Tip: always leave room to grow. A subnet that is exactly full on day one will cause a renumbering job later. Check every plan with the subnet calculator.
Real-world example: a medical clinic
A small medical clinic was given 10.20.0.0/24 by its parent group and asked for separate networks for staff PCs (about 40 devices), clinical devices (about 20), IP phones (about 25) and a guest Wi-Fi network (up to 50 phones). The network contractor sized each subnet from the host count: /26 for staff (62 usable), /26 for guests, /27 for phones (30 usable) and /27 for clinical devices. Working largest first, she allocated 10.20.0.0/26 to staff, 10.20.0.64/26 to guests, 10.20.0.128/27 to phones and 10.20.0.160/27 to clinical devices, which left 10.20.0.192/26 free for future use. Each subnet became a VLAN with its own firewall rules, so guest phones could reach only the internet.
Practice
Find the network, broadcast and usable range for 10.4.9.77/27.
You need 12 subnets from 192.168.8.0/24. Which prefix do you use and how many hosts per subnet?
Which subnet does 172.31.130.5/18 belong to?
Key takeaways
- Subnetting borrows host bits to make several smaller networks.
- For any subnet, find the network, broadcast, first host, last host and host count.
- In binary: AND with the mask for the network; set host bits to 1 for the broadcast.
- In decimal: block size = 256 minus the interesting mask octet; subnets start at multiples of it.
- Plan from the number of subnets or hosts you need, and leave room to grow.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.