CIDR Calculator — Classless Inter-Domain Routing
Welcome to Omni's CIDR calculator! Classless interdomain routing (CIDR) revolutionized the internet and how IP addresses are assigned. However, CIDR notation isn't simple at first — so we made this CIDR block calculator to help!
Our CIDR calculator can convert a CIDR block into an IP range — and, given an IP range, this CIDR block calculator will find the CIDR notation that captures that range. In this article, we'll cover essential topics such as:
- What classless interdomain routing is;
- How to calculate subnet mask from CIDR notation;
- How to calculate IP range from CIDR; and
- How to calculate CIDR from IP range.
💡 Interested in IP addresses and subnetworks? Check out our IP subnet calculator!
How to use the CIDR range calculator
This CIDR subnet calculator has two modes, which you can select with the
"I want to convert..." dropdown menu.
If you select
CIDR to IPv4 range, the CIDR calculator will determine the range of IP addresses covered by the block you enter in CIDR notation.
Give the calculator the CIDR notation — the IP address and associated subnet mask width.
Verify that the CIDR notation is correct.
Find your results at the bottom of the CIDR block calculator — we summarize the results, but we also go into depth on the subnet mask, the associated network prefix, the wildcard bits, and the range of IP addresses that this CIDR covers.
IPv4 range to CIDRmode, the CIDR calculator will determine the network block(s) that cover the range between two IP addresses.
Give the calculator two IP addresses — the first in the range and the last.
Find the corresponding network block(s) below. One block that fits nicely into CIDR notation might not exist — in such cases, the CIDR calculator gives multiple blocks that cover your range.
You can verify the output and learn about each network block with the
CIDR to IPv4 rangemode.
What is classless inter-domain routing (CIDR)?
CIDR is an ingenious method of allocation and routing of IP addresses. Before CIDR, the internet used a rather wasteful method of allocating IP addresses for specific subnetworks and their constituent hosts. Because of this inefficiency, the internet was quickly running out of IP addresses. CIDR is specifically called "classless" because it does not use "IP classes", which is exactly what made the previous system so inefficient.
What is CIDR notation?
CIDR notation is a compact way of denoting an IP address and its subnet mask. CIDR notation consists of an IP address, a slash (
/), and a number between 0 and 32. This is the number of consecutive
1-bits (followed by more
0-bits) that make up the 32-bit subnet mask.
How to calculate IP range from CIDR
There are three steps to calculating the IP range from CIDR:
- Find the subnet mask.
- Apply the subnet mask.
- Use the wildcard bits to determine the IP range.
18.104.22.168/25 as an example throughout this process.
Find the subnet mask
The number after the slash is the width of our subnet mask. Our example (
22.214.171.124/25) has a subnet mask width of
25, meaning the mask has 25
1-bits and an additional 7
0-bits (to add up to 32 bits).
We can visualize the bits of the IP address and the mask as follows:
💡 Not sure what these "bit" things are? Head on over to our binary calculator to learn more!
Apply the subnet mask
We've just learned how to calculate the subnet mask from CIDR notation. We can apply this mask to the IP address (rewritten in binary) with the bitwise AND operation. In practice, we take only the first 25 bits (since 25 is the decimal number in our CIDR,
126.96.36.199/25) and discard the rest.
What's left is called the subnet prefix, which acts as an identifier for the block to which the specific IP address
188.8.131.52/25 belongs. Our example's subnet prefix is
💡 Check out our bitwise calculator for more information on the bitwise AND operation and others!
Determine the IP range
The bits not covered by the subnet mask are called the wildcard bits, and they are available to be filled with unique bit combinations to form unique IP addresses that all fall within our subnetwork. The zeros in the subnet mask are the wildcard bits, and so they are:
Now that we know which bits can be changed while fitting within our subnet, we can finally determine the IP range! The range starts at the IP address with all
0s in the wildcard bit positions:
And the range ends at the IP address with all
1s in these positions:
And there we have it — the IP range of the block
184.108.40.206! We can also see that we have 27 = 128 unique IP addresses in our network block.
How to calculate CIDR from IP range
While calculating the IP range from a CIDR is simple, calculating the CIDR from an IP range is more complex. In a nutshell, only some IP ranges are covered exactly by one single CIDR block. Consider the following cases, which you can verify using our CIDR subnet calculator in
IPv4 range to CIDR mode:
10.0.0.31 is covered by the single CIDR
But what happens when we change the first IP address by just one bit? The range
10.0.0.31 needs five blocks to cover it completely:
Unfortunately, there's no smart solution to finding these CIDRs — you have to work it out by hand, consult a CIDR database, or use our CIDR notation calculator.
How do I calculate IP range from CIDR?
To extract the IP range from CIDR notation:
- Determine the subnet mask from the number after the slash.
- Find the network prefix by applying the mask to the IP address in binary form.
- Fill all the wildcard bits (the bits not covered by the mask) with
0s — this is the start of the IP range.
- Fill the wildcard bits with
1s — this is the end of the IP range.
What is the IP range of the CIDR 10.0.0.0/8?
10.0.0.0/8 covers the range of IP addresses from
10.255.255.255, which are 16,777,216 unique IP addresses.
|Subnet mask width||0|
|First IP (network address)|
|Last IP (broadcast address)|
|Range||4,294,967,296 IP addresses|
|Number of host addresses||4,294,967,294 IP addresses|