What Is CIDR Notation and How Does Subnetting Actually Work?
CIDR notation is the compact way to describe an IP network and the size of the address block inside it. It tells you which part of an IP belongs to the network, which part is left for hosts, and how many addresses you actually get. If you want to skip the hand math, try our free CIDR calculator.
What CIDR notation actually means
CIDR stands for Classless Inter-Domain Routing. The slash format, like 192.168.1.0/24, means “the first 24 bits are the network prefix.” The rest of the bits are available for host addresses inside that subnet.
That is the whole game. An IPv4 address has 32 bits total, so a /24 leaves 8 bits for hosts, which gives 2^8 = 256 total addresses. Two of those are reserved in a normal subnet: the network address and the broadcast address, so you usually end up with 254 usable host addresses.
The slash number is not a magic label. It is a count of fixed bits, and that count directly controls subnet size. A smaller prefix like /16 means a bigger network. A larger prefix like /28 means a tighter block with fewer hosts.
Subnetting is just splitting the address space
Subnetting means taking one larger network and dividing it into smaller ones. CIDR notation makes that easy because every extra bit you borrow from the host side doubles the number of subnets and halves the number of addresses in each subnet.
Here is the basic tradeoff:
- More prefix bits = smaller subnet
- Fewer prefix bits = larger subnet
- Every step changes the address count in powers of two
For example, moving from /24 to /25 cuts the block in half. A /24 gives 256 addresses; a /25 gives 128. Keep going to /26 and you get 64, then /27 gives 32, and so on.
This is why people who manage labs, VPCs, office VLANs, or home networks care about CIDR notation. It helps you avoid wasting address space, and it keeps routing clean. One small prefix can mean the difference between “this network fits neatly” and “why are half the machines unreachable.”
How to read an IP block without getting lost
When you see an address like 10.0.8.0/21, read it as a range, not just a single IP. The prefix says the first 21 bits are fixed, which means the last 11 bits can vary. That gives 2^11 = 2048 total addresses in the subnet.
You do not need to memorize every mask immediately, but it helps to know the common ones. /24 is 255.255.255.0, /16 is 255.255.0.0, and /30 is 255.255.255.252. These are all different views of the same structure.
If you want a quick refresher on the binary side of the puzzle, our guide to IPv4 addresses in binary is a good companion read. CIDR notation gets much less mysterious once you can line up the bits and see where the split happens.
Netmasks and prefixes are two ways to say the same thing
A subnet mask such as 255.255.255.0 is the older, more verbose format. CIDR notation says the same thing more cleanly as /24. Both describe which bits are network bits and which bits are host bits.
In binary, a subnet mask looks like a string of 1s followed by 0s:
255.255.255.0 = 11111111.11111111.11111111.00000000
/24 = first 24 bits are 1sThat makes the logic obvious. The 1s mark the network portion. The 0s mark the host portion. Routers use that prefix to decide whether an address is local or should be sent onward.
Here is a practical way to think about it: if two IPs share the same prefix, they are in the same subnet. If they do not, traffic usually needs a router. That is why the prefix length matters so much in both routing and network design.
Why some subnet sizes are popular
Certain CIDR blocks show up constantly because they fit common network shapes. A /24 is a comfortable size for a small office, a test environment, or a VLAN where you want room to grow without wasting too much space. A /30 used to be common for point-to-point links because it gives exactly two usable host addresses.
Cloud networks and container platforms also lean on CIDR notation heavily. In a VPC, for example, you might carve a large private block like 10.0.0.0/16 into smaller subnet blocks such as 10.0.1.0/24 and 10.0.2.0/24. That keeps app tiers separated while still staying inside one larger address space.
IPv6 uses the same idea, just with a much larger address space. You will still see prefixes like /64, and the same “prefix plus host space” rule applies. The notation survives because it scales cleanly.
A Worked Example
Let’s split one network into smaller pieces and see how the numbers move. Start with 192.168.10.0/24. That block contains 256 addresses, from 192.168.10.0 through 192.168.10.255.
If you want four equal subnets, you borrow two bits from the host side. That changes the prefix from /24 to /26. Each subnet now has 64 total addresses, or 62 usable hosts.
Original block:
192.168.10.0/24
Split into 4 subnets:
192.168.10.0/26 usable hosts: 192.168.10.1 - 192.168.10.62
192.168.10.64/26 usable hosts: 192.168.10.65 - 192.168.10.126
192.168.10.128/26 usable hosts: 192.168.10.129 - 192.168.10.190
192.168.10.192/26 usable hosts: 192.168.10.193 - 192.168.10.254Notice the pattern. The block size jumps by 64 each time because /26 leaves 6 host bits, and 2^6 = 64. Once you know the prefix, you can calculate the subnet boundaries without guessing.
Now compare that with a non-obvious block like 172.16.32.0/20. A /20 gives 4096 addresses total, and the third octet moves in chunks of 16. So the network range runs from 172.16.32.0 to 172.16.47.255. That is the kind of thing a calculator is good at, because nobody needs to do bit shifts by hand three times before coffee.
Common mistakes that trip people up
The first trap is confusing network address with usable host address. The network address is the first IP in the block, and it identifies the subnet itself. It is not assigned to a device.
The second trap is forgetting that the broadcast address is also reserved in IPv4. That leaves one fewer usable address at both ends of the range. This matters when you are planning tiny networks, where losing two addresses can be a big chunk of the pool.
The third trap is assuming all prefix lengths behave like neat round numbers. They do not. A subnet can begin in the middle of an octet, and that is where binary thinking matters. If you are debugging allocation problems, this is the point where a calculator stops being nice-to-have and becomes the thing standing between you and an hour of error messages.
Also, CIDR notation is not the same as an IP range written with a hyphen. 192.168.1.0/24 is a structured network block. 192.168.1.10-192.168.1.50 is just a range. They can overlap, but they are not interchangeable.
How routing uses prefixes
Routers do not care about friendly names. They care about prefixes and longest-match rules. If a destination IP matches multiple routes, the router picks the most specific prefix available.
That is why a route table might include both 10.0.0.0/8 and 10.0.4.0/24. Traffic for 10.0.4.23 matches both, but the /24 wins because it is more specific. This is called longest prefix match, and it is one of the core ideas behind modern IP routing.
This same logic shows up in access control lists, firewall rules, and cloud route tables. A broad prefix gives you a wide net. A narrow prefix lets you target a specific subnet with precision.
Frequently Asked Questions
What does the number after the slash in CIDR notation mean?
It tells you how many leading bits in the IP address are fixed as the network prefix. For IPv4, the total is 32 bits, so /24 means 24 network bits and 8 host bits. The higher the number after the slash, the smaller the subnet.
How many usable IP addresses are in a /24?
A /24 contains 256 total addresses. In normal IPv4 subnetting, two are reserved: the network address and the broadcast address. That leaves 254 usable host addresses.
What is the difference between CIDR notation and a subnet mask?
They describe the same network boundary in different formats. CIDR notation uses a slash prefix like /24, while a subnet mask uses dotted decimal like 255.255.255.0. CIDR is shorter and easier to scan, which is why it is the standard in most modern tooling.
Why is CIDR notation important in routing?
Routers use CIDR prefixes to decide where packets should go. When multiple routes match, the most specific prefix wins. That makes CIDR notation the backbone of route aggregation, subnet design, and firewall rules.
Wrapping Up
CIDR notation is just a compact way to say how big a network is and where its boundaries sit. Once you understand the prefix length, subnetting stops feeling like random memorisation and starts looking like bit math with a purpose. The rest is counting in powers of two and keeping track of the reserved addresses.
If you are planning a network, debugging an allocation, or just trying to sanity-check someone else’s config, work from the prefix first and the IP range second. And if you do not want to do the arithmetic by hand, use the CIDR calculator tool to map prefixes, ranges, and host counts without the usual spreadsheet ritual.
For deeper practice, take one subnet you already know and convert it both ways: prefix to mask, then mask back to prefix. That is usually the moment CIDR notation clicks for good.