# CIDR Calculator — Classless Inter-Domain Routing

Created by Rijk de Wet
Reviewed by Steven Wooding
Last updated: Jun 17, 2023

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.

1. Give the calculator the CIDR notation — the IP address and associated subnet mask width.

2. Verify that the CIDR notation is correct.

3. 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.

• In IPv4 range to CIDR mode, the CIDR calculator will determine the network block(s) that cover the range between two IP addresses.

1. Give the calculator two IP addresses — the first in the range and the last.

2. 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.

3. You can verify the output and learn about each network block with the CIDR to IPv4 range mode.

## 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:

3. Use the wildcard bits to determine the IP range.

We'll use 172.161.25.102/25 as an example throughout this process.

The number after the slash is the width of our subnet mask. Our example (172.161.25.102/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!

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, 172.161.25.102/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 172.161.25.102/25 belongs. Our example's subnet prefix is 172.161.25.0.

💡 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 172.161.25.102/25 is 172.161.25.0 to 172.161.25.127! 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:

The range 10.0.0.0 to 10.0.0.31 is covered by the single CIDR 10.0.0.0/27. Great!

But what happens when we change the first IP address by just one bit? The range 10.0.0.1 to 10.0.0.31 needs five blocks to cover it completely:

CIDR

Starts at

Ends at

#

10.0.0.1/32

10.0.0.1

10.0.0.1

1

10.0.0.2/31

10.0.0.2

10.0.0.3

2

10.0.0.4/30

10.0.0.4

10.0.0.7

4

10.0.0.8/29

10.0.0.8

10.0.0.15

8

10.0.0.16/28

10.0.0.16

10.0.0.31

16

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.

## FAQ

### How do I calculate IP range from CIDR?

To extract the IP range from CIDR notation:

1. Determine the subnet mask from the number after the slash.
2. Find the network prefix by applying the mask to the IP address in binary form.
3. Fill all the wildcard bits (the bits not covered by the mask) with 0s — this is the start of the IP range.
4. 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?

The CIDR 10.0.0.0/8 covers the range of IP addresses from 10.0.0.0 to 10.255.255.255, which are 16,777,216 unique IP addresses.

Rijk de Wet
I want to convert...
CIDR to IPv4 range
Enter your IP's octets (the numbers separated by dots) and the subnet mask width (the number after the slash) below:
First octet of IP
.
Second octet of IP
.
Third octet of IP
.
Fourth octet of IP
/
Your IP and subnet in CIDR notation is
0.0.0.0/0
Result
See the calculations?
No
People also viewed…

### Black Friday

How to get best deals on Black Friday? The struggle is real, let us help you with this Black Friday calculator!

### CSS aspect ratio

Our CSS aspect ratio calculator allows you to quickly resize your files to fit in a designated area.

### Podcasts

Do you feel like you could be doing something more productive or educational while on a bus? Or while cleaning the house? Well, why don't you dive into the rich world of podcasts! With this podcast calculator, we'll work out just how many great interviews or fascinating stories you can go through by reclaiming your 'dead time'!

### RAID

This RAID calculator will help you decide which configuration of disks (RAID level) is right for you, based on usable capacity, fault-tolerance, performance, and cost.