Subnet calculation can seem like magic when you first start. But it's really just basic math — and once you see the pattern, you'll be calculating subnets in your sleep. Let's walk through it together.
At its core, subnetting divides a network into smaller pieces. The key formula you need to remember:
We subtract 2 because every subnet has two reserved addresses:
192.168.1.0) identifies the subnet itself192.168.1.255) sends a message to everyone on the subnetHere's a quick reference table showing how many host bits you get with each CIDR prefix:
| CIDR | Host Bits | Total Addresses | Usable Hosts |
|---|---|---|---|
| /24 | 8 | 256 | 254 |
| /25 | 7 | 128 | 126 |
| /26 | 6 | 64 | 62 |
| /27 | 5 | 32 | 30 |
| /28 | 4 | 16 | 14 |
| /29 | 3 | 8 | 6 |
| /30 | 2 | 4 | 2 |
Let's work through a real example. You have the IP address 192.168.1.100/26 and want to know everything about this subnet.
CIDR /26 = 255.255.255.192 Binary: 11111111.11111111.11111111.11000000
The last octet has 2 ones (the network "borrows" 2 bits from the host portion).
IP: 192.168.1.100 Mask: 255.255.255.192 AND them together: 192.168.1.100 AND 255.255.255.192 = 192.168.1.64 Network Address: 192.168.1.64
The broadcast is the network address with all host bits set to 1:
Network: 192.168.1.01000000 Host bits: ^^ (last 6 bits) Set to 1: 192.168.1.01111111 = 192.168.1.127 Broadcast Address: 192.168.1.127
First usable: 192.168.1.65 (network + 1) Last usable: 192.168.1.126 (broadcast - 1) Range: 192.168.1.65 - 192.168.1.126 Total usable hosts: 62
IP: 10.0.0.50/25 - Network: 10.0.0.0 - Broadcast: 10.0.0.127 - Range: 10.0.0.1 - 10.0.0.126 - Usable hosts: 126
IP: 172.16.10.75/28 - Network: 172.16.10.64 - Broadcast: 172.16.10.79 - Range: 172.16.10.65 - 172.16.10.78 - Usable hosts: 14
IP: 192.168.1.10/30 - Network: 192.168.1.8 - Broadcast: 192.168.1.11 - Range: 192.168.1.9 - 192.168.1.10 - Usable hosts: 2
/30 subnets are perfect for point-to-point connections between routers — you only need 2 IP addresses!
If you don't want to do binary math every time, here's a handy trick:
So the subnets fall at multiples of 64: 0, 64, 128, 192...
192.168.1.0/26 → 0-63 192.168.1.64/26 → 64-127 192.168.1.128/26 → 128-191 192.168.1.192/26 → 192-255
While understanding the math is important, using a subnet calculator is much faster for real-world work. Our calculator handles all of this instantly:
Enter any IP address and subnet mask, and you'll get the network address, broadcast address, first/last usable IP, and total host count — all in a split second.