Updated 2 hours ago
When you see 192.168.1.0/24, you're looking at a question: which addresses belong together? Subnet calculation isn't abstract math—it's the gate every packet passes through. Same subnet? Talk directly. Different subnet? Find a router.
What You're Solving For
Given an IP address with CIDR notation like 192.168.5.0/24, you want:
- Network address — Where this range starts (can't assign to hosts)
- Broadcast address — Where it ends (can't assign to hosts)
- Usable host range — Every address between them
- Total capacity — How many devices fit
The Binary Foundation
IP addresses are 32-bit binary numbers. Dotted decimal is for humans; networks think in binary. Understanding this makes everything else obvious.
What CIDR Notation Means
The /24 in 192.168.5.0/24 means "the first 24 bits identify the network." The remaining 8 bits identify hosts.
The subnet mask marks this division:
The subnet mask is a stencil. Lay it over any address, and it reveals which neighborhood that address belongs to.
Finding the Network Address
The network address has all host bits set to 0. Find it with a binary AND—wherever the mask has 1, keep the IP bit; wherever 0, the result is 0.
What network does 192.168.5.85/24 belong to?
The host bits became 0. This is the network address—the start of the range.
Finding the Broadcast Address
The broadcast address has all host bits set to 1. Take the network address and flip every host bit.
Usable Hosts
Everything between network and broadcast can be assigned:
When the Boundary Splits an Octet
Here's where it gets interesting: 10.50.100.75/22
The /22 means 22 network bits—which cuts through the middle of the third octet.
The range spans 100, 101, 102, 103 in the third octet. Those last 2 bits of the third octet are host bits—they count through four values (00, 01, 10, 11) whether you expected it or not. Subnet boundaries don't respect octet boundaries.
The Quick Math Method
Once the binary clicks, you can calculate most subnets mentally.
Block Size
Subnets divide address space into equal blocks. The block size comes from host bits:
Block size tells you where boundaries fall:
Which Subnet Contains This IP?
Divide the relevant octet by block size.
192.168.5.85/27:
Common Subnet Sizes
Note: /31 networks are a special case for point-to-point links (RFC 3021). Both addresses are usable—no network or broadcast reserved.
Practical Example: Dividing an Office Network
You have 10.20.30.0/24 and need 4 departmental subnets.
Each department becomes its own broadcast domain. They communicate through a router, but broadcasts stay local.
Reference Tables
Which Octet Changes?
- /24 to /32 — 4th octet only
- /16 to /23 — 3rd octet changes
- /8 to /15 — 2nd octet changes
- Less than /8 — 1st octet changes
Partial Octet Mask Values
Powers of 2
Verify Your Work
After calculating, check:
- Network address: all host bits = 0
- Broadcast address: all host bits = 1
- First usable = network + 1
- Last usable = broadcast - 1
- Total addresses = 2^(host bits)
Frequently Asked Questions About Subnet Calculation
Sources
Was this page helpful?