Subnetting Made Simple: A Beginner's Guide to Understanding IP Networks

If you’ve started learning about networking, you’ve probably come across the word subnetting. At first, it might seem confusing with all the numbers, masks, and calculations. But don’t worry, it’s not as complicated as it looks.
In this blog, I’ll explain subnetting in a way that’s easy to follow, even if you're not from a tech background. We’ll walk through what it is, why it matters, and how it works, step by step. By the end, you’ll have a clearer picture of how devices in a network are organized and how IP addresses are grouped.
Before we dive into subnetting, it's helpful to understand how IP addresses were originally divided. These are called IP address classes. While classful addressing isn’t used much today, learning it gives you a better idea of how IP ranges are grouped.
Here’s a quick look at the different IPv4 classes:
Class | Starting Bits | Range (1st Octet) | Default Subnet Mask | Usage |
A | 0xxxxxxx | 1 – 126 | 255.0.0.0 | Large networks |
B | 10xxxxxx | 128 – 191 | 255.255.0.0 | Medium-sized networks |
C | 110xxxxx | 192 – 223 | 255.255.255.0 | Small networks |
D | 1110xxxx | 224 – 239 | N/A | Multicast |
E | 1111xxxx | 240 – 255 | N/A | Reserved (Experimental) |
Note: 127.x.x.x is reserved for loopback (testing) and not used for networks.
Now that we’ve looked at the different IPv4 classes, you might be wondering who’s in charge of handing out all these IP addresses in the first place?
That’s where IANA, or the Internet Assigned Numbers Authority, comes in.
IANA stands for Internet Assigned Numbers Authority. It’s the organization responsible for managing and coordinating some of the key parts of the internet that need to be globally unique.
In simple terms, IANA handles:
IP address allocation
Management of the DNS root zone (like .com, .org, .net)
Assigning protocol numbers and port numbers
When it comes to IP addresses, IANA gives large blocks to regional internet registries (RIRs), which then assign smaller chunks to internet service providers (ISPs) or organizations.
So, IANA helps keep the internet organized and running smoothly by making sure the same numbers and names aren’t used in the wrong places.
Back then, networks used fixed classes (like Class A, B, or C) to group IP addresses. But as more people and devices started connecting to the internet, those fixed sizes didn’t always fit well. Sometimes you’d get more IP addresses than you needed, or not enough.
To solve this problem, CIDR (which stands for Classless Inter-Domain Routing) was introduced. It made things more flexible by letting us divide IP addresses based on what we actually need—not what the class says.
Instead of sticking to classes, CIDR uses something called prefix notation. For example, you might see an IP like 192.168.1.0/24
. That /24
tells the network how many parts of the IP are used to identify the network, and how many are left for devices.
The good thing about CIDR is it helps save IP addresses and makes networks more efficient. And this is where subnetting really starts to make sense.
Let’s go ahead and break down what subnetting means and how it works.
Now that you know how CIDR gives us flexibility, it’s time to talk about subnetting.
Subnetting is the process of taking one big network and breaking it into smaller pieces, called subnets. It helps organize a network better, improves security, and makes traffic flow more efficiently. Think of it like dividing a large room into smaller sections so everyone has their own space.
Why Do We Subnet?
To avoid wasting IP addresses
To separate different departments or groups in a network
To make networks easier to manage and troubleshoot
How to Subnet (Step-by-Step)
Let’s walk through the basics of how to subnet an IP address. Don’t worry, you don’t need to be a math expert to understand this.
Step 1: Know your IP address and prefix
Let’s say you’re working with this network:192.168.1.0/24
The /24
means the first 24 bits are for the network, and the rest (8 bits) are for hosts.
With /24
, you have:
256 total IP addresses
254 usable addresses (since 1 is reserved for the network and 1 for broadcast)
Step 2: Decide how many subnets or hosts you need
Let’s say you want to split this network into 4 smaller subnets. To figure out how many bits you need to borrow from the host portion, use this formula:
2^n ≥ number of subnets you need
In our case:
- 2² = 4 → So we borrow 2 bits from the host part.
Step 3: Update the subnet mask
If we borrow 2 bits from /24
, we now have /26
.
New subnet mask:
255.255.255.192
This gives us 4 subnets with 64 IPs each (62 usable per subnet)
Step 4: List the new subnets
Here’s how the new subnets look:
Subnet | Network Address | First Usable | Last Usable | Broadcast Address |
1 | 192.168.1.0/26 | 192.168.1.1 | 192.168.1.62 | 192.168.1.63 |
2 | 192.168.1.64/26 | 192.168.1.65 | 192.168.1.126 | 192.168.1.127 |
3 | 192.168.1.128/26 | 192.168.1.129 | 192.168.1.190 | 192.168.1.191 |
4 | 192.168.1.192/26 | 192.168.1.193 | 192.168.1.254 | 192.168.1.255 |
Each subnet now has its own set of usable IP addresses, which you can assign to different departments or groups.
That’s the basic idea behind subnetting. Once you understand how to borrow bits and calculate ranges, subnetting becomes a lot easier.
Before we dive into actually breaking a network into subnets, there are two important formulas you need to know. Don’t worry, they’re not as scary as they look, and once you understand how they work, subnetting becomes much easier.
Formula 1: 2^x – Finding the Number of Subnets
Use this when you want to know how many subnets you can create.
x = number of bits you borrow from the host portion
The result = number of subnets
Think of this as: the more bits you borrow, the more subnets you get.
Example:
You have a /24
network (which means 8 bits for hosts) and you want to create 4 subnets.
Use the formula:2^x = number of subnets
2^2 = 4
→ So you borrow 2 bits
New prefix becomes: /24 + 2 = /26
That means your new subnets will now use a /26 mask.
Formula 2: 2ⁿ - 2 – Finding Usable Hosts per Subnet
Use this when you want to know how many devices can fit in each subnet.
n = number of host bits left after borrowing
Subtract 2 because one IP is for the network address and one for the broadcast address
Continuing the example:
You borrowed 2 bits from a /24
, so 6 bits are left for hosts (8 - 2 = 6)
Use the formula:2^6 - 2 = 64 - 2 = 62 usable IP addresses
Each of your 4 new subnets can now hold up to 62 devices.
These two formulas go hand in hand when subnetting.
Use the first to figure out how many subnets you can make.
Use the second to check if each subnet will have enough IPs for your needs.
Let’s say we have this network:
192.168.1.0/24
That means:
It’s a Class C-like network
Default subnet mask is:
255.255.255.0
We have 256 total IP addresses (254 usable)
Goal: Break this into 4 subnets
Step 1: Convert IP and Subnet Mask to Binary
IP Address:192.168.1.0
→11000000.10101000.00000001.00000000
Subnet Mask (/24
):255.255.255.0
→11111111.11111111.11111111.00000000
The first 24 bits (the 1s) are for the network, and the last 8 bits (the 0s) are for hosts.
Step 2: Use the Formula to Find Needed Bits
We want 4 subnets, so we use:2^x = number of subnets
2^2 = 4
→ We need to borrow 2 bits from the host portion
Now, our subnet mask becomes /26
That means 26 bits for network, and 6 bits left for hosts (32 - 26)
New Subnet Mask (in binary):11111111.11111111.11111111.11000000
\= 255.255.255.192
Step 3: Find the Subnet Ranges
Each subnet will have 2^6 = 64 total IPs
Usable IPs: 64 - 2 = 62
per subnet
Now let’s list them:
Subnet # | Network Address | First Usable IP | Last Usable IP | Broadcast Address |
1 | 192.168.1.0/26 | 192.168.1.1 | 192.168.1.62 | 192.168.1.63 |
2 | 192.168.1.64/26 | 192.168.1.65 | 192.168.1.126 | 192.168.1.127 |
3 | 192.168.1.128/26 | 192.168.1.129 | 192.168.1.190 | 192.168.1.191 |
4 | 192.168.1.192/26 | 192.168.1.193 | 192.168.1.254 | 192.168.1.255 |
What Happened in Binary?
Take the 4th octet (the last part of the IP address):
Before subnetting (with /24):00000000
to 11111111
→ This gives you the whole range: 0 to 255
After borrowing 2 bits:
Those first 2 bits of the last octet are now used to define the subnet
The remaining 6 bits are for hosts
So:
Subnet 1 starts with
00xxxxxx
→ Range:.0
to.63
Subnet 2 starts with
01xxxxxx
→ Range:.64
to.127
Subnet 3 starts with
10xxxxxx
→ Range:.128
to.191
Subnet 4 starts with
11xxxxxx
→ Range:.192
to.255
Each range goes up by 64.
By converting to binary, you can clearly see:
How the network and host parts of the IP are divided
How borrowing bits creates new subnets
How each subnet gets its own range of usable IPs
Subnetting might look tricky at first, but once you understand how the bits work, it becomes much easier. And you don’t always need to convert to binary but doing it a few times helps you really understand what's going on behind the scenes.
Now that we’ve seen how subnetting works using binary, let’s switch gears and try a method that doesn’t need pen, paper, or a calculator. Yep, you can actually learn how to subnet using just your fingers.
This method is great when you're just starting out or when you're in a time crunch, like during an exam or hands-on practice.
We'll also share a few CIDR and subnetting shortcuts that will save you time and help you solve subnetting problems quickly.
Let’s start with the hands-on trick.
Subnetting Using Your Hands (For CIDR / Prefix Length)
This trick helps you figure out how many hosts or how many subnets you can get—just by counting bits on your fingers.
Remember: IPv4 addresses have 32 bits total.
If you're dealing with something like /26
, just do this:
Hold up 10 fingers (or however many you need to count)
Start counting from
/32
backwards to/24
,/23
,/22
, etc.Count how many bits are left for hosts. That's
32 - prefix length
Example: How many usable hosts in /26
?
/26
→32 - 26 = 6 bits left for hosts
Use this formula:
2⁶ - 2 = 64 - 2 = 62 usable hosts
That means each /26
subnet can have up to 62 devices.
You can do this kind of calculation just by remembering the powers of 2:
2⁰ = 1
2¹ = 2
2² = 4
2³ = 8
2⁴ = 16
2⁵ = 32
2⁶ = 64
2⁷ = 128
2⁸ = 256
Keep those in your head—or on your fingers—and you’re good to go.
✂️ Subnetting Shortcuts (CIDR Cheat Tips)
Here are a few quick tips to make subnetting faster:
1. CIDR to Number of Hosts
Just subtract the prefix from 32 to get host bits.
Then do 2^n - 2
to get usable IPs.
CIDR | Usable Hosts |
/30 | 2 |
/29 | 6 |
/28 | 14 |
/27 | 30 |
/26 | 62 |
/25 | 126 |
/24 | 254 |
Memorizing this table (or the pattern) saves time.
2. Block Size Trick
To quickly find the range of each subnet, use this:
Block Size = 256 - value in the 4th octet of subnet mask
For example, /26
is 255.255.255.192
→ last octet is 192
Block size: 256 - 192 = 64
So the subnet ranges are:0-63
, 64-127
, 128-191
, 192-255
3. Shortcut to Borrow Bits
Want 8 subnets? Use 2^x = 8
→ x = 3 bits to borrow
From /24
, borrow 3 → /27
Each subnet will now have: 2^(8-3) - 2 = 30 usable IPs
Using these tips, you’ll get faster at subnetting without needing to convert to binary every time. But try to understand the logic first then use the shortcuts later.
Practice Scenario:
You’re given the network:
192.168.10.0/24
You need 5 subnets. Let’s figure out:
How many bits to borrow
The new subnet mask
The usable IP ranges for each subnet
Step 1: How many bits do we borrow?
We use the formula:2^x ≥ number of subnets you need
We need 5 subnets →2^3 = 8
→ So, we need to borrow 3 bits
Step 2: New prefix length
Original: /24
Borrowed: +3
New: /27
Step 3: Find block size
Look at the 4th octet of the new subnet mask:
/27
→255.255.255.224
256 - 224 = 32
→ This is our block size
So each subnet jumps by 32.
Step 4: List the subnets
We can now break 192.168.10.0/24
into 8 subnets, but we only need 5. Let’s list them anyway to be sure.
Subnet # | Network Address | First Usable IP | Last Usable IP | Broadcast Address |
1 | 192.168.10.0/27 | 192.168.10.1 | 192.168.10.30 | 192.168.10.31 |
2 | 192.168.10.32/27 | 192.168.10.33 | 192.168.10.62 | 192.168.10.63 |
3 | 192.168.10.64/27 | 192.168.10.65 | 192.168.10.94 | 192.168.10.95 |
4 | 192.168.10.96/27 | 192.168.10.97 | 192.168.10.126 | 192.168.10.127 |
5 | 192.168.10.128/27 | 192.168.10.129 | 192.168.10.158 | 192.168.10.159 |
You now have 5 subnets with 30 usable IPs each. Mission complete.
To make it easier to see the pattern, here’s a table that shows different prefix lengths, their subnet masks, how many subnets you can get, and how many usable hosts are available per subnet—from Class A all the way to Class C:
Class A (Default: /8 — 255.0.0.0)
Prefix | Subnet Mask | Number of Subnets (2^x) | Number of Usable Hosts/Subnet (2^n - 2) |
/8 | 255.0.0.0 | 1 | 16,777,214 |
/9 | 255.128.0.0 | 2 | 8,388,606 |
/10 | 255.192.0.0 | 4 | 4,194,302 |
/11 | 255.224.0.0 | 8 | 2,097,150 |
/12 | 255.240.0.0 | 16 | 1,048,574 |
/13 | 255.248.0.0 | 32 | 524,286 |
/14 | 255.252.0.0 | 64 | 262,142 |
/15 | 255.254.0.0 | 128 | 131,070 |
/16 | 255.255.0.0 | 256 | 65,534 |
Class B (Default: /16 — 255.255.0.0)
Prefix | Subnet Mask | Number of Subnets (2^x) | Number of Usable Hosts/Subnet (2^n - 2) |
/16 | 255.255.0.0 | 1 | 65,534 |
/17 | 255.255.128.0 | 2 | 32,766 |
/18 | 255.255.192.0 | 4 | 16,382 |
/19 | 255.255.224.0 | 8 | 8,190 |
/20 | 255.255.240.0 | 16 | 4,094 |
/21 | 255.255.248.0 | 32 | 2,046 |
/22 | 255.255.252.0 | 64 | 1,022 |
/23 | 255.255.254.0 | 128 | 510 |
/24 | 255.255.255.0 | 256 | 254 |
Class C (Default: /24 — 255.255.255.0)
Prefix | Subnet Mask | Number of Subnets (2^x) | Number of Usable Hosts/Subnet (2^n - 2) |
/24 | 255.255.255.0 | 1 | 254 |
/25 | 255.255.255.128 | 2 | 126 |
/26 | 255.255.255.192 | 4 | 62 |
/27 | 255.255.255.224 | 8 | 30 |
/28 | 255.255.255.240 | 16 | 14 |
/29 | 255.255.255.248 | 32 | 6 |
/30 | 255.255.255.252 | 64 | 2 |
/31 | 255.255.255.254 | — | 0* or 2** (special use) |
/32 | 255.255.255.255 | — | 1 (for single host) |
/31 was originally unusable but is now used for point-to-point links * /32 is for loopbacks or host routes
Now that you understand how prefix lengths and subnetting work, you might be wondering, do we always have to use equal-sized subnets?
The answer is no. In real-world networks, not all departments or networks need the same number of IP addresses. That’s where VLSM comes in.
VLSM stands for Variable Length Subnet Masking. Instead of dividing your network into equal parts, you can customize each subnet based on how many IPs it actually needs. This helps save IP addresses and keeps your network efficient.
What Is VLSM, Really?
Think of VLSM like cutting a cake but instead of slicing it into equal pieces, you cut bigger slices for bigger appetites and smaller ones for those who just want a bite.
With basic subnetting, you split everything into equal blocks. But with VLSM, you assign subnet sizes based on actual needs. This means no wasted IPs and a more efficient use of your address space.
Why Use VLSM?
Let’s say you’re given 192.168.1.0/24 and you need to make networks for:
Dept A – needs 100 hosts
Dept B – needs 50 hosts
Dept C – needs 25 hosts
Dept D – needs 10 hosts
If you just divide it evenly, you might waste a lot of addresses. But with VLSM, you can give each department just what they need.
How to Apply VLSM (Step-by-Step)
Step 1: List subnets in order from largest to smallest.
Start with the one that needs the most IPs. This helps avoid overlap or running out of space.
Department | Hosts Needed | Add 2 (network + broadcast) | Total Required |
Dept A | 100 | +2 | 102 |
Dept B | 50 | +2 | 52 |
Dept C | 25 | +2 | 27 |
Dept D | 10 | +2 | 12 |
Step 2: Find the smallest subnet that can fit each.
You’ll use the 2^n - 2
formula in reverse to find the prefix length.
Dept | Total IPs Needed | Smallest Power of 2 | CIDR (/n) |
A | 102 | 128 → 2⁷ | /25 |
B | 52 | 64 → 2⁶ | /26 |
C | 27 | 32 → 2⁵ | /27 |
D | 12 | 16 → 2⁴ | /28 |
Step 3: Assign subnets from top down.
Start from 192.168.1.0 and move forward based on block sizes:
Dept | Subnet | Range | Broadcast |
A | 192.168.1.0/25 | 192.168.1.1 – 192.168.1.126 | 192.168.1.127 |
B | 192.168.1.128/26 | 192.168.1.129 – 192.168.1.190 | 192.168.1.191 |
C | 192.168.1.192/27 | 192.168.1.193 – 192.168.1.222 | 192.168.1.223 |
D | 192.168.1.224/28 | 192.168.1.225 – 192.168.1.238 | 192.168.1.239 |
Done! You’ve just applied VLSM. You gave each department what they needed and still have room left.
Quick Tip
When learning VLSM, write everything down:
IPs needed
Block size (2^n)
CIDR
Start and end IPs
It gets easier with practice. You don’t need to memorize right away. Just understand the pattern and do it step by step.
Practice Makes Progress
Subnetting can feel tricky at first, and that’s totally normal. It really just takes repetition and a bit of patience. I’m still learning too, and I use practice sites to sharpen my skills so I thought I’d share them with you.
Here are some sites I personally use to practice subnetting:
Additional Practice:
Subnetting Motor Questions – great for building speed
Subnetting.org – simple and easy to follow
Subnetting Practice – has lots of challenging questions if you want to push yourself
I suggest starting slow and solving them by hand first. Don’t worry if you get some wrong. You’ll improve the more you try just like I am.
Wrapping It Up
Subnetting might look intimidating at first, but once you understand the basics like CIDR, binary conversion, and the purpose of subnet masks, it becomes a lot more manageable. We also looked at how VLSM helps save IP addresses by giving just the right amount to each subnet.
If you’re just starting out, take your time. Practice is key. Use the tools and links I shared, try solving problems by hand, and don’t stress if you don’t get it right away.
I'm not a networking pro. Just someone learning and sharing along the way. If this blog helped you even a little, I’m glad. Feel free to share it with others who are also learning.
Thanks for reading, and keep going!
Subscribe to my newsletter
Read articles from Pits directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
