CIDR Notation and IP Ranges Explained
Classless Inter-Domain Routing (CIDR) notation describes a block of IP addresses. A block is written as an address followed by a slash and a prefix length, such as 203.0.113.0/24. A larger prefix length means a smaller range.
Registries allocate address blocks, and networks announce which blocks they can route traffic to. Such a routing announcement tells other networks how to reach that range. Many registration or network facts apply to blocks. Reading the prefix tells you how many addresses a result covers.
What does the slash number mean?
Start with simple IPv4 blocks where the slash lines up with the numbers between dots. The green part is fixed. The blue part can be any number from 0 to 255.
| CIDR block | Visual read | What it covers |
|---|---|---|
| 10.0.0.0/8 |
10.any.any.any
|
About 16.7 million IPv4 addresses |
| 192.168.0.0/16 |
192.168.any.any
|
65,536 IPv4 addresses |
| 192.168.1.0/24 |
192.168.1.any
|
256 IPv4 addresses |
| 8.8.8.8/32 |
8.8.8.8
|
One IPv4 address |
The prefix length is the number after the slash. It tells you how many leading binary digits, called bits, are fixed for the network. In the simple examples above, /8 fixes one dotted number, /16 fixes two, and /24 fixes three. A /32 fixes the entire IPv4 address. Other prefixes can split inside a dotted number, but the idea is the same: more fixed bits means a smaller block.
To calculate an IPv4 block size yourself, use 2^(32 − prefix length) addresses.
How do IPv4 subnet masks relate to CIDR prefixes?
A CIDR prefix length and an IPv4 subnet mask describe the same boundary. The prefix length counts consecutive network bits set to 1; the remaining host bits are 0. Each dotted number in the mask represents eight bits, so /24 means three complete groups of eight network bits: 11111111.11111111.11111111.00000000, written in decimal as 255.255.255.0.
Prefixes can also split inside a dotted number. For example, /25 adds one network bit in the final octet and corresponds to 255.255.255.128. Use the IP subnet calculator to convert prefixes and masks and inspect the resulting address range.
Which address spans do uneven prefixes create?
| Uneven example | Size | Address span |
|---|---|---|
| 172.16.0.0/12 | 1,048,576 IPv4 addresses | 172.16.0.0 - 172.31.255.255 |
| 10.10.16.0/20 | 4,096 IPv4 addresses | 10.10.16.0 - 10.10.31.255 |
| 203.0.113.128/25 | 128 IPv4 addresses | 203.0.113.128 - 203.0.113.255 |
| 203.0.113.16/28 | 16 IPv4 addresses | 203.0.113.16 - 203.0.113.31 |
| 203.0.113.40/29 | 8 IPv4 addresses | 203.0.113.40 - 203.0.113.47 |
Which subnet mask matches each IPv4 prefix length?
This table maps IPv4 prefix lengths from /0 through /32 to their dotted-decimal network masks and total address counts. The class labels mark old default boundaries; modern CIDR is classless.
| Prefix size | Network mask | Total addresses |
|---|---|---|
| /0 | 0.0.0.0 | 4,294,967,296 |
| /1 | 128.0.0.0 | 2,147,483,648 |
| /2 | 192.0.0.0 | 1,073,741,824 |
| /3 | 224.0.0.0 | 536,870,912 |
| /4 | 240.0.0.0 | 268,435,456 |
| /5 | 248.0.0.0 | 134,217,728 |
| /6 | 252.0.0.0 | 67,108,864 |
| /7 | 254.0.0.0 | 33,554,432 |
| Historical Class A boundary | ||
| /8 | 255.0.0.0 | 16,777,216 |
| /9 | 255.128.0.0 | 8,388,608 |
| /10 | 255.192.0.0 | 4,194,304 |
| /11 | 255.224.0.0 | 2,097,152 |
| /12 | 255.240.0.0 | 1,048,576 |
| /13 | 255.248.0.0 | 524,288 |
| /14 | 255.252.0.0 | 262,144 |
| /15 | 255.254.0.0 | 131,072 |
| Historical Class B boundary | ||
| /16 | 255.255.0.0 | 65,536 |
| /17 | 255.255.128.0 | 32,768 |
| /18 | 255.255.192.0 | 16,384 |
| /19 | 255.255.224.0 | 8,192 |
| /20 | 255.255.240.0 | 4,096 |
| /21 | 255.255.248.0 | 2,048 |
| /22 | 255.255.252.0 | 1,024 |
| /23 | 255.255.254.0 | 512 |
| Historical Class C boundary | ||
| /24 | 255.255.255.0 | 256 |
| /25 | 255.255.255.128 | 128 |
| /26 | 255.255.255.192 | 64 |
| /27 | 255.255.255.224 | 32 |
| /28 | 255.255.255.240 | 16 |
| /29 | 255.255.255.248 | 8 |
| /30 | 255.255.255.252 | 4 |
| /31 | 255.255.255.254 | 2 |
| /32 | 255.255.255.255 | 1 |
The table counts every address in each block. A /0 covers the entire IPv4 address space and is commonly used as a default route. Under the traditional IPv4 subnet convention, the first address is the network address and the last is the broadcast address, so a /24 is often described as 254 usable host addresses even though it contains 256 total addresses. A /31 can use both addresses on a point-to-point link, and a /32 identifies one address.
How do IPv6 prefix lengths work?
The same notation works for IPv6. In a /64, the first four hexadecimal groups are fixed and the remaining four can vary:
The block above is 2001:db8:1234:5678::/64, the usual size for one IPv6 network segment. Providers commonly delegate larger prefixes that contain many of these segments.
IPv6 normally uses prefix lengths rather than an IPv4-style dotted-decimal subnet mask. An IPv6 address has 128 bits and is written in hexadecimal, so a prefix such as /64 states the network boundary directly without translating it into a long mask representation. An IPv6 block contains 2^(128 − prefix length) addresses, and a /128 identifies one address.
/48
Contains 256 /56 delegations and 65,536 /64 segments.
/56
Contains 256 /64 segments.
/64
One normal IPv6 network segment.
These sizes describe network structure, not a universal customer boundary. Providers may delegate a /48, /56, /64, or another size as a customer prefix according to their policies. A visible /64 may be one network segment, one host, or part of a larger customer delegation. For background on the two address versions, see IPv4 and IPv6 addresses.
Why do ranges matter in an IP lookup?
Most network facts are properties of a block rather than of one address. Registries delegate prefixes. Networks exchange announcements about them using Border Gateway Protocol (BGP), the rules for sharing routing information. IP intelligence feeds also list prefixes. That is why an IP lookup reports the block an address belongs to.
IP Lens shows the most specific block registered for an address as the IP Prefix, and when available, also shows a larger Delegated Prefix that a registry handed to an organization. Reading the prefix tells you how broad a fact is: a tag or registration record that applies to a /16 covers far more addresses than one that applies to a /29. See IP registries for who delegates these blocks.
How can I block or allow a range without overblocking?
Treat every prefix as a choice about how many addresses a rule affects. A narrow block or allow rule affects fewer unrelated users, while a broad rule is easier to maintain but risks including addresses that only share the same provider, city, office, or hosting platform. Start with the most specific evidence you have, then widen only when the pattern is clearly shared across the range.
| Scope | Use when | Overblocking risk |
|---|---|---|
| IPv6 /128 | One IPv6 address is the only address tied to the event, such as one abusive endpoint or one known partner address. | Lowest. Start here before grouping temporary addresses into a broader prefix. |
| /32 | One IPv4 address is the only address tied to the event, such as one abusive server or one known partner endpoint. | Lowest, but it risks missing nearby addresses used by the same service or attacker. |
| /24 | Several IPv4 addresses in the same small network show the same behavior, or the provider publishes the whole /24 as one service. | Moderate. Cloud, hosting, and access networks mix unrelated customers inside one /24. |
| /16 | The decision is about a known organization or provider allocation, not a single user or one small incident. | High. A /16 covers many sites, services, or customers, so blocking it risks denying legitimate traffic. |
| IPv6 /64 | Several harmful IPv6 addresses appear in the same observed /64, and you need a narrow, temporary containment rule. | The /64 is not a knowable customer boundary. It can be shared, assigned per host, or sit inside a broader delegation. Review the rule and use provider-specific evidence before widening it. |
| Larger ranges | The policy is intentionally about a whole provider allocation, internal network, or published service range supported by separate evidence. | Very high. Use broad ranges only when the operational reason is stronger than the risk of blocking or trusting unrelated addresses. |
Blocking and allowing have different failure modes. A broad block risks false positives; a broad allow rule risks bypassing protections for unrelated traffic. Review rules after an incident cools down, and prefer more specific prefixes when the original evidence was narrow.