CIDR notation writes an IP network as an address followed by a slash and a prefix length, such as 192.168.1.0/24. The number after the slash says how many leading bits of the 32-bit IPv4 address are the network part; the rest identify hosts. A /24 fixes 24 bits, leaving 8 host bits, so the block holds 256 addresses, of which 254 can be assigned to hosts.
Key takeaways
- The number after the slash is the count of network bits: /24 means the first 24 of 32 bits are fixed, leaving 8 bits for hosts.
- A block holds 2 raised to the power of (32 minus prefix) addresses; subtract 2 for the network and broadcast addresses to get usable hosts.
- CIDR replaced the old Class A, B and C system in 1993 and is defined by RFC 4632; it also applies to IPv6, where /64 is the usual subnet size.
You will meet CIDR notation everywhere in networking: firewall rules, cloud VPC settings, VPN configs and router tables. It looks cryptic at first — 192.168.1.0/24, 10.0.0.0/8, 2001:db8::/32 — but it is just a compact way of writing an IP address and its subnet mask in one short string.
What is CIDR notation?
CIDR notation writes an IP network as an address followed by a slash and a prefix length, such as 192.168.1.0/24. CIDR stands for Classless Inter-Domain Routing, and the number after the slash says how many leading bits of the address are the network part. The remaining bits identify hosts inside that network.
The definition comes from RFC 4632, published in August 2006, which defines a prefix as an address followed by a decimal value between 0 and 32 that describes the number of significant bits. That RFC replaced the original CIDR specification, RFC 1519 from 1993, and it remains the current standard.
Every IP address does two jobs at once. Part of it says which network a device is on, and the rest says which device on that network. CIDR notation makes the split explicit, so there is no guessing about where the network ends and the host begins.
How do you read CIDR notation?
Read it in two parts. The address before the slash is a starting address, usually the network address, and the number after the slash is the prefix length. A larger prefix number means a smaller block, because more bits are fixed and fewer are left for hosts.
Take 10.0.0.0/8. The /8 fixes the first 8 bits, which is the first octet, so every address from 10.0.0.0 to 10.255.255.255 is in the block — more than 16 million addresses. Take 192.168.1.0/24 instead: the /24 fixes three octets, so the block runs from 192.168.1.0 to 192.168.1.255, just 256 addresses. Each extra bit in the prefix halves the block.
One common confusion is the difference between a host address and a network address in CIDR form. Writing 192.168.1.42/24 means the host 192.168.1.42 sits in the /24 network whose network address is 192.168.1.0. Writing 192.168.1.0/24 means the network itself. Both use the same prefix, but they refer to different things.
What do the common CIDR prefixes mean?
The table below covers the prefixes you will see most often. The formula behind every row is simple: total addresses equals 2 raised to the power of 32 minus the prefix length, and usable hosts equals that total minus 2, for the network and broadcast addresses.
| Prefix | Subnet mask | Total addresses | Usable hosts | Typical use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | 10.0.0.0/8 private range |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 | 172.16.0.0/12 private range |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Cloud VPC, 192.168.0.0/16 |
| /20 | 255.255.240.0 | 4,096 | 4,094 | Large subnet |
| /22 | 255.255.252.0 | 1,024 | 1,022 | Campus or guest Wi-Fi |
| /24 | 255.255.255.0 | 256 | 254 | Home and office LANs |
| /25 | 255.255.255.128 | 128 | 126 | Half of a /24 |
| /26 | 255.255.255.192 | 64 | 62 | Small VLAN |
| /27 | 255.255.255.224 | 32 | 30 | Small VLAN |
| /28 | 255.255.255.240 | 16 | 14 | Point-to-point links, small groups |
| /29 | 255.255.255.248 | 8 | 6 | Small device groups |
| /30 | 255.255.255.252 | 4 | 2 | Router-to-router link |
| /31 | 255.255.255.254 | 2 | 2* | Point-to-point link (RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1 | A single host |
The /31 row is the exception to the minus-two rule. RFC 3021 allows both addresses in a /31 to be used as hosts on point-to-point links, since a two-device link needs no network or broadcast address. Every other prefix from /0 to /30 loses two addresses.
How do you convert CIDR notation to a subnet mask?
The prefix length is the number of one-bits in the subnet mask, counted from the left. Fill whole octets with 255 first, then convert the leftover bits: one leftover bit is 128, two are 192, three are 224, four are 240, five are 248, six are 252 and seven are 254.
For /21, that means 8 plus 8 plus 5 bits, so the mask is 255.255.248.0. Going the other way, 255.255.255.224 has 8 plus 8 plus 8 plus 3 one-bits, so it is /27. Once you know the leftover-bit values, you can convert any prefix in your head.
The mask and the prefix carry the same information, but they are used in different places. Masks appear in older device settings and in operating system network panels, while CIDR prefixes appear in firewall rules, cloud consoles and routing tables. DigitalOcean networking guide walks through the same conversion with more worked examples.
How do you work out the network address from CIDR notation?
The mechanical answer is a bitwise AND of the address and the mask: a bit is 1 in the result only where both the address and the mask have a 1. For 192.168.10.42/24, the mask is 255.255.255.0, so the AND keeps the first three octets and zeroes the last one, giving the network address 192.168.10.0.
The broadcast address is the last address in the block: 192.168.10.255 for that /24. Usable hosts run from 192.168.10.1 to 192.168.10.254. If a device is configured with 192.168.10.42/24, it knows that any address starting 192.168.10 is local, and anything else must go through the gateway.
A trickier example shows why the prefix matters. Take 192.168.10.64/26: the mask is 255.255.255.192, so the last octet is split with 2 network bits and 6 host bits. The block runs from 192.168.10.64 to 192.168.10.127, with usable hosts from .65 to .126 and broadcast .127. The same address, 192.168.10.64, in a /24 would be an ordinary host — in a /26 it is a network address.
What are the private IP ranges in CIDR notation?
Three ranges never appear on the public internet. RFC 1918 reserves them for private networks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Your home router almost certainly hands out addresses from 192.168.0.0/16, and large companies often use 10.0.0.0/8.
Note that 172.16.0.0/12 is wider than it looks: the /12 fixes only the first 12 bits, so the range covers 172.16.0.0 through 172.31.255.255, not just 172.16. Private addresses are not routable on the public internet, so a router doing network address translation must rewrite them to a public address before traffic leaves.
Other special ranges use CIDR notation too. The documentation range 192.0.2.0/24, known as TEST-NET-1, is reserved for examples in documentation, and the loopback address is 127.0.0.1/8. You can check your own public address with our free IP checker.
How does CIDR notation work for IPv6?
IPv6 uses the same slash notation, but the addresses are 128 bits long instead of 32, so prefixes run from /0 to /128. A /64 is the standard size for a single IPv6 subnet, and it holds 2 to the power of 64 addresses — so many that every device on a network can have its own public address without translation.
Common IPv6 prefixes include 2001:db8::/32, the documentation range, and ::1/128, the IPv6 loopback address. A /48 is often assigned to a single site, which the site then splits into /64 subnets. The same rules apply as in IPv4: the prefix fixes the network bits, and the rest identify hosts.
One practical difference is that IPv6 addresses are written in hexadecimal groups separated by colons, and leading zeroes can be compressed, so 2001:0db8:0000:0000:0000:0000:0000:0000/32 becomes 2001:db8::/32. The slash still means exactly the same thing: the count of fixed network bits.
Why did CIDR replace Class A, B and C?
Before CIDR, IPv4 addresses were divided into fixed classes: Class A networks used /8, Class B used /16 and Class C used /24, and nothing in between existed. A company that needed 300 addresses had to take a whole Class B block of 65,536 addresses, wasting nearly all of it, while a company that needed 300,000 addresses could not get a block that size at all.
CIDR, introduced in 1993 and updated by RFC 4632 in 2006, removed the class boundaries. Variable-length subnet masking lets any prefix length describe a block of any power-of-two size, so address space can be sized to actual need. The same change let routers aggregate many small blocks into one advertised route, which slowed the growth of global routing tables.
RFC 4632 gives a worked example: a provider holding 10.24.0.0/13 advertises only that one aggregate route upstream, while its customers use smaller pieces such as 10.24.0.0/21 and 10.24.16.0/20. Without aggregation, the provider would have to advertise every customer block separately.
Where will you meet CIDR notation?
Firewall rules are the most common place. A rule that allows 10.0.0.0/8 lets through a whole corporate network, while a rule for 203.0.113.42/32 allows exactly one host. Getting the prefix wrong here is a real security mistake: allowing 10.0.0.0/8 when you meant 10.1.2.0/24 opens far more than intended. Our guide to the best firewall for banks shows how these rules fit into a bank network.
Cloud networks are the second place. When you create a VPC in AWS, Google Cloud or Azure, you choose a CIDR block such as 10.0.0.0/16, then split it into subnets such as 10.0.1.0/24 for public servers and 10.0.2.0/24 for private ones. VPN configurations use CIDR too: the allowed address range in a WireGuard config is written as a CIDR block.
You can also calculate CIDR blocks in code instead of by hand. Python standard library module ipaddress does it in one line: ipaddress.ip_network("192.168.1.0/24") gives the network, its broadcast address and its hosts, and strict=False lets you pass a host address and get its containing network. That is the reliable way to check your arithmetic before you paste a range into a firewall.
What mistakes do people make with CIDR notation?
The most common mistake is confusing the prefix number with the number of hosts. A /24 does not mean 24 hosts; it means 24 network bits and 256 addresses. The second mistake is forgetting the network and broadcast addresses: a /24 has 254 usable hosts, not 256, and assigning .0 or .255 to a device will break its connectivity.
The third mistake is using a host address where a network address belongs. Writing a firewall rule for 192.168.1.42/24 when you mean the whole network is wrong; the rule should be 192.168.1.0/24. Some tools accept the host form and silently correct it, but others reject it or, worse, apply it literally.
The fourth mistake is getting the range wrong on non-octet boundaries. In 172.16.0.0/12 the second octet runs from 16 to 31, not just 16, and in 192.168.10.64/26 the last octet runs from 64 to 127. Always work out the range with the mask rather than guessing from the first address. Our guide to securing your Wi-Fi covers the home-network side of this.
The bottom line
CIDR notation is just an address plus a count of network bits, but that one number controls the size of the block, the subnet mask, the network and broadcast addresses, and which hosts belong. Learn the formula — 2 to the power of 32 minus the prefix — and the common prefixes in the table above, and you can read any range you meet.
Start by checking your own network: find your public address with the free IP checker, then work out your home subnet from your router settings. Once you can do that, firewall rules and cloud VPC settings stop looking like code and start looking like plain arithmetic.
Frequently asked questions
What does /24 mean in CIDR notation?
The /24 means the first 24 bits of the 32-bit IPv4 address are the network part, and the remaining 8 bits identify hosts. A /24 block holds 256 addresses, from the network address to the broadcast address, with 254 usable for hosts.
How many hosts are in a /24 subnet?
A /24 subnet holds 256 addresses in total, and 254 of them can be assigned to hosts. The first address is the network address and the last is the broadcast address, and neither can be assigned to a device.
What is the difference between CIDR notation and a subnet mask?
They carry the same information in two formats. A subnet mask such as 255.255.255.0 is a 32-bit mask written as four numbers, while /24 counts the one-bits in that mask. The prefix length is the number of leading one-bits in the mask.
What is the difference between /16 and /24?
A /16 fixes 16 bits and leaves 16 host bits, so it holds 65,536 addresses. A /24 fixes 24 bits and leaves 8 host bits, so it holds 256 addresses. The /16 block is 256 times larger than the /24 block.
What does /32 mean?
A /32 fixes all 32 bits, so the block contains exactly one IPv4 address. It is used to refer to a single host, for example when allowing one specific IP address through a firewall or routing a single address.
Does CIDR notation work for IPv6?
Yes. IPv6 addresses are 128 bits, so CIDR prefixes run from /0 to /128. A /64 is the standard size for a single IPv6 subnet, and a /128 refers to one IPv6 address, just as /32 does for IPv4.
What are the private IP ranges in CIDR notation?
RFC 1918 reserves three ranges for private networks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. These addresses never appear on the public internet and are the ranges you see on home and office networks.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 4632, the CIDR standard, Amazon VPC CIDR documentation, RIPE Database documentation and DigitalOcean networking documentation.
How we write and fact-check →