Subnetting becomes much easier once you stop treating CIDR prefixes and subnet masks as numbers to memorize.
The basic process is always similar:
- Start with an IP network.
- Decide how many subnets or hosts you need.
- Determine how many bits must be used for the network.
- Calculate the new prefix and subnet mask.
- Find the size of each subnet.
- Identify the network, usable host range and broadcast address.
In this guide, we will calculate everything manually using one main example:
192.168.1.0/24
Our requirement is:
Divide this network into 8 equal subnets.
By the end, we will arrive at eight /27 networks and understand exactly why their addresses begin at .0, .32, .64, .96 and so on.
If concepts such as CIDR, subnet masks, network addresses and broadcast addresses are still unfamiliar, read our beginner guide to subnetting first before continuing.
The Starting Network: 192.168.1.0/24
We begin with:
192.168.1.0/24
IPv4 addresses contain 32 bits.
The /24 tells us that 24 of those bits belong to the network portion.
That leaves:
32 - 24 = 8 host bits
So our starting point is:
Network bits: 24
Host bits: 8
Conceptually:
Network portion Host portion
11111111.11111111.11111111 | 00000000
24 bits | 8 bits
A /24 network contains:
2^8 = 256 addresses
For traditional IPv4 LAN subnetting, two addresses are normally unavailable for ordinary hosts:
- one network address
- one broadcast address
So a /24 normally provides:
256 - 2 = 254 usable host addresses
But we do not want one /24 anymore.
We want 8 smaller networks.
Step 1 — Understand the Original Network
Our original network is:
192.168.1.0/24
Its basic information is:
| Property | Value |
|---|---|
| Network | 192.168.1.0/24 |
| Subnet mask | 255.255.255.0 |
| Network bits | 24 |
| Host bits | 8 |
| Total addresses | 256 |
| Traditional usable hosts | 254 |
The question is now:
How many of those 8 host bits must become network bits so that we can create 8 subnets?
This process is commonly called borrowing bits.
Step 2 — Calculate How Many Bits We Need for 8 Subnets
To calculate the number of subnet bits required, use:
2^n ≥ required number of subnets
Where:
n = number of bits we need to borrow
We need:
8 subnets
Try the powers of two:
2^1 = 2
2^2 = 4
2^3 = 8
Therefore:
2^3 = 8
We need to borrow:
3 bits
from the original host portion.
Before:
24 network bits
8 host bits
After borrowing 3 bits:
27 network bits
5 host bits
That single change determines almost everything that follows.
Step 3 — Calculate the New CIDR Prefix
The original prefix is:
/24
We borrowed:
3 bits
Therefore:
24 + 3 = 27
Our new prefix is:
/27
So each of our eight subnets will use a /27 prefix.
The transition can be summarized as:
/24
↓ borrow 3 bits
/27
Step 4 — Calculate the New Subnet Mask
A /27 prefix means that the subnet mask contains:
27 ones
followed by:
5 zeros
In binary:
11111111.11111111.11111111.11100000
The first three octets are easy:
11111111 = 255
The final octet is:
11100000
Using the standard binary values:
128 64 32 16 8 4 2 1
1 1 1 0 0 0 0 0
Add the active values:
128 + 64 + 32 = 224
Therefore:
/27
equals:
255.255.255.224
So our network configuration now uses:
CIDR: /27
Subnet mask: 255.255.255.224
Step 5 — Calculate the Remaining Host Bits
IPv4 has 32 bits.
Our new prefix uses 27 of them for the network.
Therefore:
32 - 27 = 5
We have:
5 host bits
remaining in every subnet.
This matters because the number of host bits determines how many addresses each subnet contains.
Step 6 — Calculate the Number of Addresses per Subnet
If we have 5 host bits, the number of possible combinations is:
2^5 = 32
Therefore every /27 subnet contains:
32 total IPv4 addresses
Notice how the original /24 contained 256 addresses:
256 ÷ 8 = 32
That gives us another way to verify that the result makes sense.
Eight equal subnets, each containing 32 addresses:
8 × 32 = 256
We have divided the entire original /24 address space without losing or overlapping any addresses.
Step 7 — Calculate the Usable Host Addresses
For traditional IPv4 subnetting, every subnet normally reserves:
- the first address as the network address
- the last address as the broadcast address
Each /27 contains:
32 addresses
Therefore:
32 - 2 = 30
Each subnet provides:
30 usable host addresses
The general beginner formula is:
Usable hosts = 2^h - 2
where:
h = number of host bits
For /27:
h = 5
2^5 - 2
= 32 - 2
= 30
The
-2rule has exceptions, particularly/31point-to-point networks and/32host routes. For ordinary LAN subnetting exercises, however, this is the standard formula.
Step 8 — Calculate the Block Size
Now we need to determine where each subnet begins.
Our subnet mask is:
255.255.255.224
The changing octet is the final octet:
224
A common shortcut is:
Block size = 256 - subnet mask value
So:
256 - 224 = 32
Our block size is:
32
This means every subnet begins 32 addresses after the previous one.
Starting at zero:
0
32
64
96
128
160
192
224
These become the network addresses:
192.168.1.0
192.168.1.32
192.168.1.64
192.168.1.96
192.168.1.128
192.168.1.160
192.168.1.192
192.168.1.224
This is one of the most useful subnetting patterns to understand.
Once you know the block size, finding the subnet boundaries becomes much easier.
Step 9 — Calculate the Network and Broadcast Addresses
Take the first subnet:
192.168.1.0/27
The next subnet begins at:
192.168.1.32
Therefore the first subnet must end one address before that:
192.168.1.31
That is the broadcast address.
So:
Network:
192.168.1.0
First usable:
192.168.1.1
Last usable:
192.168.1.30
Broadcast:
192.168.1.31
Now look at the second subnet.
It begins at:
192.168.1.32
The following subnet starts at:
192.168.1.64
So its broadcast address is:
192.168.1.63
Its usable range is therefore:
192.168.1.33 - 192.168.1.62
The same pattern continues throughout the /24.
The Final 8 Subnets
Here is the complete result:
| # | Network | First Usable | Last Usable | Broadcast |
|---|---|---|---|---|
| 1 | 192.168.1.0/27 |
192.168.1.1 |
192.168.1.30 |
192.168.1.31 |
| 2 | 192.168.1.32/27 |
192.168.1.33 |
192.168.1.62 |
192.168.1.63 |
| 3 | 192.168.1.64/27 |
192.168.1.65 |
192.168.1.94 |
192.168.1.95 |
| 4 | 192.168.1.96/27 |
192.168.1.97 |
192.168.1.126 |
192.168.1.127 |
| 5 | 192.168.1.128/27 |
192.168.1.129 |
192.168.1.158 |
192.168.1.159 |
| 6 | 192.168.1.160/27 |
192.168.1.161 |
192.168.1.190 |
192.168.1.191 |
| 7 | 192.168.1.192/27 |
192.168.1.193 |
192.168.1.222 |
192.168.1.223 |
| 8 | 192.168.1.224/27 |
192.168.1.225 |
192.168.1.254 |
192.168.1.255 |
Our final result is:
Original network:
/24
Borrowed bits:
3
New prefix:
/27
Subnet mask:
255.255.255.224
Number of subnets:
8
Addresses per subnet:
32
Usable hosts per subnet:
30
Block size:
32
A Simple Way to Check Your Answer
Before moving on, verify three things.
1. Did we create enough subnets?
2^3 = 8
Yes.
2. Does each subnet have the expected number of addresses?
2^5 = 32
Yes.
3. Do all subnets together equal the original network?
8 × 32 = 256
Yes.
The calculation is internally consistent.
Example 2 — Divide 10.0.0.0/24 Into 4 Subnets
Now we will repeat the same process with a different requirement.
Our starting network is:
10.0.0.0/24
We need:
4 subnets
Step 1 — Find the Number of Borrowed Bits
We need the smallest value of n where:
2^n ≥ 4
We have:
2^2 = 4
So we borrow:
2 bits
Step 2 — Calculate the New Prefix
Starting prefix:
/24
Borrow:
2 bits
Therefore:
24 + 2 = 26
New prefix:
/26
Step 3 — Find the Subnet Mask
A /26 corresponds to:
255.255.255.192
The final octet is:
11000000
or:
128 + 64 = 192
Step 4 — Calculate the Block Size
Use:
256 - 192 = 64
Therefore the network addresses increase by:
64
Starting from zero:
0
64
128
192
Our four subnets are:
10.0.0.0/26
10.0.0.64/26
10.0.0.128/26
10.0.0.192/26
Step 5 — Calculate Hosts per Subnet
A /26 leaves:
32 - 26 = 6 host bits
Therefore:
2^6 = 64 total addresses
Traditionally usable:
64 - 2 = 62
So each /26 provides:
62 usable host addresses
The complete result is:
| Network | First Usable | Last Usable | Broadcast |
|---|---|---|---|
10.0.0.0/26 |
10.0.0.1 |
10.0.0.62 |
10.0.0.63 |
10.0.0.64/26 |
10.0.0.65 |
10.0.0.126 |
10.0.0.127 |
10.0.0.128/26 |
10.0.0.129 |
10.0.0.190 |
10.0.0.191 |
10.0.0.192/26 |
10.0.0.193 |
10.0.0.254 |
10.0.0.255 |
The important lesson is that we followed exactly the same process as before.
The numbers changed, but the method did not.
Example 3 — What If You Know the Required Number of Hosts Instead?
Subnetting questions do not always begin with:
How many subnets do I need?
Sometimes the requirement is:
I need a subnet that can support at least 50 hosts.
Now we work in the opposite direction.
Instead of finding enough subnet bits, we need to find enough host bits.
Step 1 — Use the Host Formula
For traditional IPv4 subnetting:
2^h - 2 ≥ required hosts
where:
h = number of host bits
We need at least:
50 usable hosts
Try 5 host bits:
2^5 - 2
= 32 - 2
= 30
Thirty usable addresses are not enough.
Try 6 bits:
2^6 - 2
= 64 - 2
= 62
That is enough.
So we need:
6 host bits
Step 2 — Calculate the Prefix
IPv4 contains:
32 bits
If 6 bits must remain for hosts:
32 - 6 = 26
Therefore the required subnet is:
/26
A /26 provides:
64 total addresses
62 traditionally usable addresses
That satisfies our requirement of 50 hosts.
Why Not Use /25?
A /25 would also support 50 hosts:
2^7 - 2 = 126 usable hosts
But it would allocate far more addresses than necessary.
If the goal is to find the smallest traditional IPv4 subnet capable of supporting 50 hosts, /26 is the appropriate size.
This is one reason subnetting matters in real network design: it allows address space to be matched more closely to actual requirements.
Two Types of Subnetting Questions
At this point, you should recognize two common problem types.
Type 1 — Required Number of Subnets
Example:
192.168.1.0/24
Need:
8 subnets
Use:
2^n ≥ number of required subnets
Then borrow enough bits.
Type 2 — Required Number of Hosts
Example:
Need:
50 hosts per subnet
Use:
2^h - 2 ≥ required hosts
Then keep enough bits for hosts.
This distinction is extremely important.
Before doing any subnet calculation, first ask:
Am I solving for the number of subnets or for the number of hosts?
A Useful CIDR Reference Table
You should understand the calculations rather than depend entirely on memorization, but a reference table is useful when checking your work.
| CIDR | Subnet Mask | Total Addresses | Traditional Usable Hosts |
|---|---|---|---|
/24 |
255.255.255.0 |
256 | 254 |
/25 |
255.255.255.128 |
128 | 126 |
/26 |
255.255.255.192 |
64 | 62 |
/27 |
255.255.255.224 |
32 | 30 |
/28 |
255.255.255.240 |
16 | 14 |
/29 |
255.255.255.248 |
8 | 6 |
/30 |
255.255.255.252 |
4 | 2 |
Notice the pattern:
/24 → 256 addresses
/25 → 128
/26 → 64
/27 → 32
/28 → 16
/29 → 8
/30 → 4
Every time the prefix increases by one bit, the number of addresses is cut in half.
How to Find the Subnet Containing an Existing IP Address
You may also encounter a question such as:
Which subnet contains
192.168.1.74/27?
We already know that /27 has a block size of:
32
The network boundaries are therefore:
0
32
64
96
128
160
192
224
The address:
192.168.1.74
falls between:
64
and:
95
Therefore its network is:
192.168.1.64/27
Its broadcast address is:
192.168.1.95
And the usable host range is:
192.168.1.65
through
192.168.1.94
This type of calculation becomes very useful when troubleshooting real networks.
Common Beginner Subnetting Mistakes
Subnetting calculations are repetitive, which means most mistakes come from a few predictable areas.
Confusing Total Addresses With Usable Hosts
A /27 contains:
32 addresses
but in traditional IPv4 LAN subnetting it normally provides:
30 usable hosts
Do not use the two numbers interchangeably.
Forgetting the Network Address
For:
192.168.1.32/27
the address:
192.168.1.32
is the network address, not the first usable host.
The first usable address is:
192.168.1.33
Forgetting the Broadcast Address
For the same subnet:
192.168.1.32/27
the next subnet begins at:
192.168.1.64
Therefore:
192.168.1.63
is the broadcast address.
The last usable host is:
192.168.1.62
Confusing CIDR With the Subnet Mask
This:
/27
is a CIDR prefix length.
This:
255.255.255.224
is its dotted-decimal subnet mask.
They represent the same network boundary, but they are not written in the same format.
Using 255 Instead of 256 for Block Size
The shortcut is:
256 - mask value
not:
255 - mask value
For /27:
256 - 224 = 32
not 31.
Creating Overlapping Subnets
If your block size is 32, subnet boundaries must follow:
0
32
64
96
128
160
192
224
A network such as:
192.168.1.40/27
is not a valid /27 network boundary.
The address .40 belongs to:
192.168.1.32/27
Do We Still Exclude Subnet Zero?
Older networking material sometimes teaches that the first and last subnets should not be used.
You may therefore encounter older calculations that produce fewer usable subnets from the same borrowed bits.
That restriction is obsolete for normal modern IP networking.
For example, when dividing:
192.168.1.0/24
into /27 networks, this is a valid subnet:
192.168.1.0/27
and so is:
192.168.1.224/27
For modern subnetting exercises and network designs, all eight /27 subnets in our example can be used.
A Beginner’s Subnetting Workflow
When you encounter a subnetting problem, follow this order.
For a required number of subnets:
1. Identify the original prefix
2. Calculate the original host bits
3. Determine the required number of subnets
4. Find n where 2^n ≥ required subnets
5. Borrow n bits
6. Calculate the new prefix
7. Convert the prefix to a subnet mask
8. Calculate remaining host bits
9. Calculate addresses per subnet
10. Calculate usable hosts
11. Calculate the block size
12. List the network addresses
13. Find each broadcast address
14. Find the usable host ranges
For a host requirement, begin instead with:
2^h - 2 ≥ required hosts
and determine how many host bits must remain.
That is the core of manual IPv4 subnetting.
Practice Question
Before looking at the answer, try this yourself:
Divide
192.168.10.0/24into 4 equal subnets.
Ask yourself:
How many bits must be borrowed?
What is the new CIDR prefix?
What is the subnet mask?
How many addresses does each subnet contain?
How many usable hosts does each subnet provide?
What is the block size?
What are the four network addresses?
Answer
We need:
4 subnets
Therefore:
2^2 = 4
Borrow:
2 bits
New prefix:
/24 + 2 = /26
Subnet mask:
255.255.255.192
Addresses:
64 per subnet
Traditional usable hosts:
62 per subnet
Block size:
256 - 192 = 64
Networks:
192.168.10.0/26
192.168.10.64/26
192.168.10.128/26
192.168.10.192/26
If you reached the same result without copying the /26 example above, you are already beginning to understand the pattern rather than simply memorizing it.
Frequently Asked Questions
What formula is used to calculate the number of subnets?
Use:
2^n ≥ required subnets
where n is the number of bits borrowed from the host portion.
For eight subnets:
2^3 = 8
so three bits are required.
How do I calculate the number of hosts in a subnet?
For traditional IPv4 subnetting:
2^h - 2
where h is the number of remaining host bits.
A /27 leaves five host bits:
2^5 - 2 = 30
so it normally supports 30 usable hosts.
Why do we subtract two addresses?
Traditionally, one address identifies the subnet itself and another serves as the IPv4 broadcast address.
Those addresses are therefore not normally assigned to hosts.
There are special cases such as /31, so the rule should not be treated as universal across every IPv4 prefix.
What does block size mean in subnetting?
The block size tells you the distance between consecutive subnet network addresses.
For:
255.255.255.224
the relevant octet is 224:
256 - 224 = 32
Therefore the networks begin at:
0, 32, 64, 96, 128, 160, 192, 224
Is /27 the same as 255.255.255.224?
Yes.
They are two ways of expressing the same subnet mask:
/27
equals:
255.255.255.224
Is subnetting different on Windows and Linux?
The mathematics is the same.
A /27 means the same thing whether the device runs Windows, Linux, macOS, a router operating system or another IP-capable platform.
What changes is how you configure the IP address, subnet mask, gateway and routes on the operating system.
That is why configuration is best covered separately from subnet calculation.
From Subnet Calculation to Real Network Configuration
We started with:
192.168.1.0/24
and a requirement for:
8 subnets
Then we calculated:
2^3 = 8
so we borrowed three bits:
/24 → /27
That gave us:
Subnet mask:
255.255.255.224
Addresses per subnet:
32
Usable hosts:
30
Block size:
32
and the eight networks:
192.168.1.0/27
192.168.1.32/27
192.168.1.64/27
192.168.1.96/27
192.168.1.128/27
192.168.1.160/27
192.168.1.192/27
192.168.1.224/27
The most important thing is not memorizing those addresses.
It is understanding the sequence that produced them:
Requirement
↓
Borrow bits
↓
New prefix
↓
Subnet mask
↓
Host bits
↓
Addresses
↓
Block size
↓
Network boundaries
↓
Usable ranges and broadcasts
Once that process becomes familiar, subnetting stops looking like a collection of mysterious numbers.
The next step is to take the networks we have calculated and configure them on real systems, including Windows and Linux.
