Today is Wednesday, April 15, 2026
CIDR
CIDR stands for Classless Inter-Domain Routing.
CIDR is a new addressing scheme for the Internet which allows for more efficient allocation of IP addresses than the old Class A, B, and C address scheme.
With a new network being connected to the Internet every 30 minutes, the Internet was faced with two critical problems:
- Running out of IP addresses
- Running out of capacity in the global routing tables
An IP address is actually a binary number 32 bits long. To make it "more readable" we split the 32 bits into 4 groups of 8 bits as follows:
b31b30b29b28b27b26b25b24.b23b22b21b20b19b18b17b16.b15b14b13b12b11b10b9b8.b7b6b5b4b3b2b1b0
The first 8 bits are used to indicate the starting IP number.
The remaining 24 bits (32 -8) are used to determine ending IP number. All of the 24 remaining bits can be either 1's or 0's which is the same as 2 to the power of 24 numbers in range.
An IPV4 address we are all familiar with looks like so XXX.XXX.XXX.XXX where XXX is a number between 0 and 255. For example 127.0.0.0 or 10.0.0.1.
This address is the decimal equivalent of the 4 groups of 8 bits.
As stated previously, each bit in the group can have the value of 1 (if it exists) or 0 (if it does not exist) as shown below:
If b7b6b5b4b3b2b1b0 = 11111111 then this equals 27+26+25+ 24+23+22+ 21+20 = 128+64+32+16+8+4+2+1 = XXX = 255
If b7b6b5b4b3b2b1b0 = 00100000 then this equals 0+0+25+0+0+0+0+0 = 0+0+32+0+0+0+0+0 = XX = 32
If we had the IP range of 32.0.0.0 to 32.255.255.255 then:
- start IP = 00100000.00000000.00000000.00000000 = 32.0.0.0
- end IP = 00100000.11111111.11111111.11111111 = 32.255.255.255
IP Range To CIDR
What is the CIDR for XX.XX.XX.0 to XX.XX.XX.1 (A range of just two IP numbers)?
In binary, we know that this means the last bit can be either a 1 or a 0
Since the IP is made up from 32 binary bits, the answer is 32 bits less 31 bits equals one bit, so the answer is:
XX.XX.XX.0/31
where "/31" is called the IP prefix or network prefix.
CIDR To IP Range
By now you have probably figured out that this is the reverse of the above and it's actually easier in a sense.
XX.XX.XX.0/24 means take 32 bits, subtract 24 (leaving 8) and use that as the two's power.
Answer: 256
Therefore the IP range is XX.XX.XX.0 thru XX.XX.XX.255 (remember 0 is also one of the IP addresses)
As an other example let us look at 208.115.111.64/28.
First we know that the start IP is 208.115.111.64
We now take 32 bits and substract 28 leaving 4 and calculate 24 = 16 IPs in the sequential range
Factor to get end IP is 16-1=15
So now the end IP is 208.115.111.(64+15) = 208.115.111.79
We can now say that 208.115.111.64/28 contains the following 16 IPs:
208.115.111.64
208.115.111.65
208.115.111.66
208.115.111.67
208.115.111.68
208.115.111.69
208.115.111.70
208.115.111.71
208.115.111.72
208.115.111.73
208.115.111.74
208.115.111.75
208.115.111.76
208.115.111.77
208.115.111.78
208.115.111.79
Now let us look at 99.237.80.0/23
First we know that the start IP is 99.237.80.0
We now take 32 bits and substract 23 leaving 9 and calculate 29 = 512 = (256 + 256) IPs in the sequential range (2 groups).
We know that each group can only go up to (256-1)=255 so that the end IP of the first range would be 99.237.80.255 or 256 IPs.
Now the next range of IPs would start at 99.237.81.0 and similarily would end at 99.237.81.255
We can therefore say that 99.237.80.0/23 has an IP range of 99.237.80.0 to 99.237.81.255
Another interesting CIDR is 89.0.0.0/8
We now take 32 bits and substract 8 leaving 24 and calculate 224 = 16,777,216 = (65,536 x 256) IPs in the sequential range (65,536 groups).
In this case 89.0.0.0/8 has an IP range of 89.0.0.0 to 89.255.255.255
In general then we can say that XXX.0.0.0/8 has an IP range of XXX.0.0.0 to XXX.255.255.255
Summary
If we have a CIDR of 192.30.250.00/18:
The "192.30.250.00" is the network address itself or the starting IP address of the network.
The "18" says that the first 18 bits are the network part of the address, leaving the last 14 bits for specific host addresses.
The number of IPs in the range is found as 2
(32-18) = 2
14 = 16,384 sequential IP addresses.
With CIDR, the IP address still has 32-bits but now has a network prefix (of 13-27 bits) indicating how many of the 32 bits are specific to the network address and how many are specific to the host (or machine) address.
216.109.0.0 /24 represents the 256 IP addresses 216.109.0.0 through 216.109.0.255
The "24" indicates that the first 24 bits (216.109.0) are associated with the network address with the remaining (8) bits associated with host (machine) address.
| IP in CIDR Notation |
216.109.0.0 /24 |
| # of bits in Network Address |
24 of 32 |
| # of bits in Host Address |
8 of 32 |
| # of bits (8) in binary notation |
11111111 |
| Binary conversion to decimal |
255 (End IP Factor) |
| # of IP addresses (28) |
0 - 255 = 256 Total |
| Network Identifier(Start IP Address) |
216 |
.109 |
.0 |
.0 |
| End IP Factor |
|
|
|
.255 |
| End IP Address |
216 |
.109 |
.0 |
.255 |
216.109.0.0 /22 represents the 1024 IP addresses 216.109.0.0 through 216.109.3.255
The "22" represents that the first 22 bits are associated with the network address with the remaining 10 bits associated with the host (machine) address.
| IP in CIDR Notation |
216.109.0.0 /22 |
| # of bits in Network Address |
22 of 32 |
| # of bits in Host Address |
10 of 32 |
| # of bits (10) in binary notation |
1111111111 |
| convert to octets |
00000011.11111111 |
| Binary conversion to decimal |
3.255 (End IP Factor) |
| # of IP addresses (22)(28) |
4 × 0-255 (256) =1024 total |
| Network Identifier(Start IP Address) |
216 |
.109 |
.0 |
.0 |
| End IP Factor |
|
|
.3 |
.255 |
| End IP Address |
216 |
.109 |
.3 |
.255 |
66.249.64.0/19 represents the 8,192 IP addresses 66.249.64.0 through 66.249.95.255
The "19" indicates that the first 19 bits (66.249.64) are associated with the network address with the remaining (8) bits associated with host (machine) address.
| IP in CIDR Notation |
66.249.64.0/19 |
| # of bits in Network Address |
19 of 32 |
| # of bits in Host Address |
13 of 32 |
| # of bits (13) in binary notation |
1111111111111 |
| convert to octets |
00011111.11111111 |
| Binary conversion to decimal |
31.255 (End IP Factor) |
| # of IP addresses (25)(28) |
32 × 0-255 (256) =8192 total |
| Network Identifier(Start IP Address) |
66 |
.249 |
.64 |
.0 |
| End IP Factor |
|
|
.31 |
.255 |
| End IP Address |
66 |
.249 |
.95 |
.255 |
In terms of IP blocking, CIDR allows you to specify an entire range of IP addresses by blocking at the network address level rather than individual IP addresses. While this can save time when you wish to block a network associated with a high-risk country or organization, you should be cautious about adding ranges with CIDR notation as there is a greater potential for blocking legitimate buyers if you make a mistake
.
On A Final Note
We can specify an IP address range using CIDR as follows:
XXX.XXX.XXX.XXX/n
where XXX.XXX.XXX.XXX is the network identifier (starting IP address)
and /n is the IP Prefix or Network Prefix indicating how many of the bits are specific to the network address.
The number of IPs in the range is given by 2(32-n) .
Because a CIDR can only express the IP range as a power of 2, it can express 1, 2, 4, 8, 16, 32, 64 etc. However, you cannot express the numbers in between (like 3, 5, 6, 7, 9, 10 etc) as CIDR.
If we wanted an IP range of XXX.XXX.XXX.0 thru XXX.XXX.XXX.9 (A range of 10 IP numbers), we would not be able to do this with the CIDR.
We see that we can get a total of 10 IPs if we add the ranges 8+2=10.
We see then that we would have to use 2 CIDRs.
For the first 8 IPs:
We know that 23 = 8, so that 3 bits are assoicated with these IPs and give a network prefix of (32-3)=29 bits.
The CIDR would then be:
XXX.XXX.XXX.0/29
| IP in CIDR Notation |
XXX.XXX.XXX.0/29 |
| # of bits in Network Address |
29 of 32 |
| # of bits in Host Address |
3 of 32 |
| # of bits (3) in binary notation (22+21+20)=7 |
111 |
| Binary conversion to decimal |
7 (End IP Factor) |
| # of IP addresses (23) |
0 - 7 = 8 Total |
| Network Identifier(Start IP Address) |
XXX |
.XXX |
.XXX |
.0 |
| End IP Factor |
|
|
|
.7 |
| End IP Address |
XXX |
.XXX |
.XX |
.7 |
The IP range then is from XXX.XXX.XXX.0 to XXX.XXX.XXX.7 (8 IP addresses)
For the last 2 IPs:
We know that 21 = 2, so that 1 bit is assoicated with these IPs and gives a network prefix of (32-1)=31 bits.
From before, the end IP address was XXX.XXX.XXX.7,
so that the next IP would be XXX.XXX.XXX.8 which becomes the network prefix or starting IP address of the next range
The CIDR would then be:
XXX.XXX.XXX.8/31
| IP in CIDR Notation |
XXX.XXX.XXX.8/31 |
| # of bits in Network Address |
31 of 32 |
| # of bits in Host Address |
1 of 32 |
| # of bits (1) in binary notation |
1 |
| Binary conversion to decimal (20 =1) |
1 (End IP Factor) |
| # of IP addresses (21) |
0 - 1 = 2 Total |
| Network Identifier(Start IP Address) |
XXX |
.XXX |
.XXX |
.8 |
| End IP Factor |
|
|
|
.1 |
| End IP Address |
XXX |
.XXX |
.XXX |
.9 |
The IP range then is from XXX.XXX.XXX.8 to XXX.XXX.XXX.9 (2 IP addresses)
To specify the IP range XXX.XXX.XXX.0 to XXX.XXX.XXX.9 (10 IPs) requires 2 CIDRs as follows:
XXX.XXX.XXX.0/29 (for 8 IPs), and,
XXX.XXX.XXX.8/31 (for 2 IPs)
We see that the last group of the network identifier does not need to always end in "0".
Let us now look at a final example as follows:
72.3.128.0/17 represents the 32,768 IP addresses 72.3.128.0 through 72.3.255.255
The "17" indicates that the first 17 bits (72.3.128) are associated with the network address with the remaining (15) bits associated with host (machine) address.
| IP in CIDR Notation |
72.3.128.0/17 |
| # of bits in Network Address |
17 of 32 |
| # of bits in Host Address |
15 of 32 |
| # of bits (15) in binary notation |
111111111111111 |
| convert to octets |
01111111.11111111 |
| Binary conversion to decimal |
127.255 (End IP Factor) |
| # of IP addresses (27)(28) |
128 × 0-255 (256) =32,768 total |
| Network Identifier(Start IP Address) |
72 |
.3 |
.128 |
.0 |
| End IP Factor |
|
|
.127 |
.255 |
| End IP Address |
72 |
.3 |
.255 |
.255 |
Cases Where You Can Do a Quick Calculation
Sometimes it is possible to quickly do a calculation of the IP range based on the CIDR.
Let us look at the following CIDR:
69.84.207.128/25
We see that the starting address or network address is 69.84.207.128.
We also know that the number of bits assigned to to IP addresses is (32-25} = 7 bits.
In binary this means B3.B2.B1.01111111 as the last or end IP address factor.
This tells us that all the IP addresses are located in the last group of bits.
Converting to decimal we have:
0+26+25+24+23+22+21+20 = 64+32+16+8+4+2+1 = 127
The end IP address would then be 69.84.207.(128+127) = 69.84.207.255
A CIDR of 69.84.207.128/25 then has an IP range of:
69.84.207.128 to 69.84.207.255 with a total of 27= 128 IP addresses in the range.
Let us look at the IP range 119.63.192.0 - 119.63.199.255
End IP: 119.63.199.255
Start IP: 119.63.192.0
End IP Factor: .007.255
Convert to binary: .007.255 = .00000111.11111111
This shows that 11 bits are assigned to IP Addresses
Network Prefix = (32-11) = 21
So CIDR = 119.63.192.0/21
Let us also look at the IP Range 123.125.71.0 - 123.125.71.255
End IP: 123.125.71.255
Start IP: 123.125.71.0
End IP Factor: .255
.255 = 11111111
This shows that 8 bits are assigned to IP addresses
Network Prefix = (32-8) = 24
So CIDR = 123.125.71.0/24
Let us look at the IP range 180.76.0.0 - 180.76.255.255
End IP: 180.76.255.255
Start IP: 180.76. 0. 0
End IP Factor: .255.255
.255.255 = .11111111.11111111
This shows 16 bits are assigned to IP Addresses
Network Prefix = (32-16) = 16
So CIDR = 180.76.0.0/16
Let us look at the IP range 202.46.32.0 - 202.46.63.255
End IP: 202.46.63.255
Start IP: 202.46.32.0
End IP Factor: .31.255
.31.255 = .00011111.11111111
This shows 13 bits are assigned to IP addresses
Network Prefix = (32-13) = 19
So CIDR = 202.46.32.0/19
Let us look at the IP range 202.108.0.0 - 202.108.255.255
End IP: 202.108.255.255
Start IP: 202.108.0 .0
End IP Factor: .255.255
.255.255 = .11111111.11111111
This shows 16 bits are assigned to IP addresses
Network Prefix = (32-16) =16
So CIDR = 202.108.0.0/16
Finally, let us look at the IP range 21.22.23.0 to 21.22.23.9
End IP: 21.22.23.9
Start IP: 21.22.23.0
End IP Factor: .9
The digit 9 by itself does not have a binary equivalent,
However, 9 = 7 + 2 = 00000111 + 00000010
This tells us that we need two CIDRs in order to specify the complete IP range.
This means then:
IP Range 1 = 21.22.23.0 to 21.22.23.7
IP Range 2 = 21.22.23.8 to 21.22.23.9
Now for range 1:
End IP: 21.22.23.7
Start IP: 21.22.23.0
End IP Factor: .7
.7 = .00000111
This shows 3 bits are assigned to IP addresses for 23 = 8 IPs
Network Prefix = (32-3) =29
So CIDR = 21.22.23.0/29
Now for range 2:
End IP: 21.22.23.9
Start IP: 21.22.23.8
End IP Factor: .1
.1 = .0000001
This shows 1 bit is assigned to IP addresses for 21 = 2 IPs
Network Prefix = (32-1) =31
So CIDR = 21.22.23.8/31
The IP range 21.22.23.0 to 21.22.23.9 can be specified by the following two CIDRs:
21.22.23.0/29
21.22.23.8/31
There is a great little website that has calculators to help with IP and CIDR calculations which you can find at:
IP / CIDR Calculator
Enter IP range similar to:
21.22.23.0-21.22.23.9
If you subscribe to Schembrionics, you can learn more about CIDR and how it is used with network mask and subnets, when you click on the link below:
Network Masks and Subnets