As a network engineer, administrator, or Site Reliability Engineer (SRE) you probably have run across CIDR notation for defining IPv4 address spaces for both networks and subnets. CIDR notation is used a lot in the IT infrastructure configuration world. The following is a description of what CIDR notation is, in case you’re not that familiar, as well as a helpful CIDR range calculator and reference table. I hope these resources prove useful for you when defining CIDR ranges for your networks and subnets.
What is CIDR IPv4 Address Range Notation?
CIDR stands for “Classless Inter-Domain Routing”, and is the method used for assigning IP addresses and routing Internet traffic. IPv4 CIDR notation, specifically, is a way of representing a range of IP addresses in a concise and standardized format. CIDR notation is commonly used by network engineers, administrators, and Site Reliability Engineers (SRE) to manage IP addresses and create subnets.
CIDR notation is a flexible and efficient allocation of IP addresses by allowing the use of variable-length subnet masks. The network portion and the host portion of an IP address are not fixed, but can be specified by a number known as the CIDR prefix.
The CIDR prefix is written as a slash followed by a number between 0
(zero) and 32
. The number represents the number of network bits in the subnet mask, and is used to determine the range of IP addresses that belong to the network. For example, the CIDR prefix of /24
indicates that the first 24 bits of the IP address represent the network address, while the remaining 8 bits represents the host address.
To calculate the CIDR prefix for a given IP address range, you need to count the number of leading 1
bits in the binary representation of the subnet mask. For example, the subnet mask of 255.255.255.0 (in dotted decimal notation) has 24 leading 1
bits, so its CIDR prefix is /24
.
If this sounds a little difficult for you to calculate, then the following calculator and reference table for IPv4 CIDR notations should prove useful.
Calculate Start/End IPv4 Addresses for CIDR Range
When calculating the CIDR range of IPv4 IP addresses, it can be difficult to figure out the full range of IP Addresses that are included within the CIDR range. At least if you aren’t familiar with the binary math needed to calculate it. For this reason, I’ve included the following calculator that allows you to enter the CIDR range, click “Calculate”, then it will display the Starting IP Address and Ending IP Address of the CIDR range entered.
IPv4 Address CIDR Range Reference Table
Some times it can be difficult to remember how many IP addresses are in each of the CIDR ranges that can be defined. These range from a /0
with the entire IPv4 address space, down to a /32
that only includes a single IP address in the range.
The following table lists out all the CIDR ranges with the number of IPv4 address within that range:
CIDR Range | Address Mask | IP Address Count |
---|---|---|
/0 | 0.0.0.0 | 4,294,967,296 (entire IPv4 address space) |
/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 |
/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 |
/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 |
/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 |
Note: The IP address count column shows the total number of IP addresses within each CIDR range, including the network address and broadcast address.