How to Calculate Subnets in Your Head Without Binary Math
Want to check your work as you read? The free calculator at activeitprep.com/subnet shows each step below. Subnetting has a reputation for being painful, mostly because most guides start by converting everything to binary. You can skip that. Once you know the Magic Number method, you can find a subnet's network ID, broadcast address, and usable range with simple decimal math. I used it to pass Network+, and it's what I teach. The Three Steps Find the interesting octet. This is the octet where the mask is neither 255 nor 0. For /25 it's the 4th octet, for /20 it's the 3rd, for /12 it's the 2nd. Find the block size. Block size is 256 minus the mask value in that octet. Another way to see it: halve 256 once for every bit borrowed in that octet. Count up by the block size. Start at 0 and count up until you pass the address's value in that octet. The multiple at or below it is the network ID. The broadcast is one less than the next multiple. The usable hosts are everythin
Want to check your work as you read? The free calculator at activeitprep.com/subnet shows each step below.
Subnetting has a reputation for being painful, mostly because most guides start by converting everything to binary. You can skip that. Once you know the Magic Number method, you can find a subnet's network ID, broadcast address, and usable range with simple decimal math. I used it to pass Network+, and it's what I teach.
The Three Steps
-
Find the interesting octet. This is the octet where the mask is neither 255 nor 0. For
/25it's the 4th octet, for/20it's the 3rd, for/12it's the 2nd. - Find the block size. Block size is 256 minus the mask value in that octet. Another way to see it: halve 256 once for every bit borrowed in that octet.
- Count up by the block size. Start at 0 and count up until you pass the address's value in that octet. The multiple at or below it is the network ID. The broadcast is one less than the next multiple. The usable hosts are everything between.
Example 1: 192.168.14.77/27
-
/27borrows 3 bits in the 4th octet (27 - 24 = 3) - Halve 256 three times:
256 / 2 / 2 / 2 = 32, so the block size is 32 - Mask:
256 - 32 = 224, so255.255.255.224 - Count by 32:
0, 32, 64, 96. The value77sits in the 64 block -
Network ID:
192.168.14.64 - Next block starts at
96, so the Broadcast is192.168.14.95 -
Usable range:
192.168.14.65to192.168.14.94(30 hosts)
Example 2: When the interesting octet isn't the last one
Take 10.45.130.9/20.
-
/20borrows 4 bits in the 3rd octet (20 - 16 = 4), so the interesting octet is the third - Block size:
256 / 2 / 2 / 2 / 2 = 16, mask255.255.240.0 - Count by 16 in the 3rd octet:
..., 112, 128, 144. The value130sits in the 128 block -
Network ID:
10.45.128.0 - Next block starts at
144, so the Broadcast is10.45.143.255 -
Usable range:
10.45.128.1to10.45.143.254(4,094 hosts)
Everything after the interesting octet is 0 for the network and 255 for the broadcast.
Quick Reference Table
| CIDR | Mask (Last Octet) | Block Size | Usable Hosts |
|---|---|---|---|
| /25 | 128 | 128 | 126 |
| /26 | 192 | 64 | 62 |
| /27 | 224 | 32 | 30 |
| /28 | 240 | 16 | 14 |
| /29 | 248 | 8 | 6 |
| /30 | 252 | 4 | 2 |
Usable hosts is always total addresses minus 2, because the first address is the network ID and the last is the broadcast. Two special cases: /31 (point-to-point links, RFC 3021) has no network or broadcast address, and /32 is a single host.
Practice Problems
Try these on paper:
172.16.50.200/26192.168.1.100/2810.20.77.5/21
Click to view answers
-
Network:
172.16.50.192| Broadcast:172.16.50.255| Usable:.193to.254(62 hosts) -
Network:
192.168.1.96| Broadcast:192.168.1.111| Usable:.97to.110(14 hosts) -
Network:
10.20.72.0| Broadcast:10.20.79.255| Usable:10.20.72.1to10.20.79.254(2,046 hosts)
Test Your Subnetting Speed
If you want more reps, there are 20 graded practice problems in the free subnet calculator at activeitprep.com/subnet. It breaks down every calculation step-by-step with no signup or ads required.
Looking to go beyond standard multiple choice? Test your hands-on Network+ skills on live virtual console configurations at activeitprep.com/networking-simulator.