Free CIDR Calculator
Enter a CIDR notation to see network details
Understanding CIDR and the Subnet Calculator
Classless Inter-Domain Routing (CIDR) modernized IP address allocation and routing, moving away from the rigid class-based system that was wasting valuable address space. This CIDR calculator – also referred to as a subnet calculator or CIDR notation converter – enables you to seamlessly convert between CIDR blocks and IP ranges. Whether you need a CIDR to IP range translation or the reverse IP range to CIDR conversion, this tool handles both directions efficiently.
The calculator offers two primary operating modes, selectable via a dropdown menu:
- CIDR to IPv4 Range – Enter a CIDR notation (e.g.,
192.168.1.0/24) to obtain the full range of IPv4 addresses covered by that block, along with the subnet mask, network prefix, and wildcard bits. - IPv4 Range to CIDR – Provide a start and end IP address to determine the minimum set of CIDR blocks that exactly cover the range. If a single contiguous CIDR block cannot represent the range, the tool outputs multiple blocks.
This dual‑functionality makes it a versatile network block calculator for network engineers, students, and IT professionals.
What Is CIDR Notation?
CIDR notation is a compact representation of an IP address and its associated subnet mask. It takes the form a.b.c.d/x, where x (ranging from 0 to 32) indicates the number of leading 1‑bits in the 32‑bit subnet mask. These leading bits are the network portion, while the remaining bits (32 − x) are the host portion. CIDR eliminates the wasteful concept of IP classes, hence the term “classless”.
For instance, 172.161.25.102/25 tells us the subnet mask has 25 consecutive 1‑bits followed by 7 zero‑bits.
How to Extract an IP Range from a CIDR Block
Deriving the IP address range from a CIDR notation involves three straightforward steps. We’ll illustrate using 172.161.25.102/25.
Step 1: Determine the Subnet Mask
The prefix length (25) defines the subnet mask. A mask length of L means the first L bits of the mask are 1 and the remaining 32−L bits are 0. For /25, the mask in binary consists of 25 ones then 7 zeros:
11111111.11111111.11111111.10000000
Converting each octet to decimal yields 255.255.255.128. This is the subnet mask for the block.
Step 2: Apply the Subnet Mask (Bitwise AND)
To find the network prefix, perform a bitwise AND between the IP address (in binary) and the subnet mask. Effectively, only the first 25 bits of the IP are retained; the rest become 0. For 172.161.25.102/25:
- IP binary:
10101100.10100001.00011001.01100110 - Mask binary:
11111111.11111111.11111111.10000000 - Network prefix (result of AND):
10101100.10100001.00011001.00000000→172.161.25.0
Thus the network prefix is 172.161.25.0, which identifies the subnet.
Step 3: Identify the IP Range Using Wildcard Bits
The bits not covered by the mask – the host bits or wildcard bits – can be varied to produce all IP addresses belonging to the subnet. The mask’s zeros (here, 7 bits) mark the wildcard positions.
- Start of range: Set all wildcard bits to 0 →
172.161.25.0 - End of range: Set all wildcard bits to 1 →
172.161.25.127
Therefore, the block 172.161.25.102/25 covers addresses from 172.161.25.0 through 172.161.25.127. The total number of usable hosts is (the first and last addresses are reserved for network and broadcast).
This method works for any valid CIDR notation and can be verified using the CIDR to IPv4 range mode of the calculator.
Converting an IP Range Back to CIDR Notation
The reverse conversion – IP range to CIDR – is more complex because not every range aligns neatly with a single CIDR block. A range that starts and ends on power‑of‑two boundaries can often be expressed as one block; otherwise, it must be decomposed into several consecutive CIDR blocks.
Consider the range 10.0.0.0 – 10.0.0.31. This fits perfectly into 10.0.0.0/27 (which covers 32 addresses). However, shifting the start IP by just one address changes the picture. The range 10.0.0.1 – 10.0.0.31 cannot be captured by a single /27 block. The calculator would output five separate CIDR notations:
| CIDR Notation | Start IP | End IP | # Addresses |
|---|---|---|---|
| 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 |
Working out these blocks manually is tedious. The IPv4 range to CIDR mode of this subnet mask calculator automates the decomposition, presenting the optimal set of CIDR blocks that exactly cover the specified interval.
Why Use a CIDR Calculator?
Performing binary arithmetic by hand is error‑prone, especially when dealing with multiple blocks or uncommon prefix lengths. A dedicated CIDR to IP range and IP range to CIDR tool reduces mistakes and saves time. It serves as a reliable network block calculator for planning subnets, configuring firewall rules, or troubleshooting routing issues. By using this CIDR notation converter, you ensure accurate results every time.
FAQ
1. How do I calculate the IP range from a CIDR notation like 192.168.1.0/24?
First, find the subnet mask from the prefix length (e.g., /24 gives 255.255.255.0). Perform a bitwise AND between the IP and the mask to get the network prefix. The range starts at that network prefix and ends at the address where all host bits are set to 1. For /24, the range is 192.168.1.0 – 192.168.1.255.
2. What does the number after the slash in CIDR notation represent?
It indicates the length of the network prefix, i.e., the number of consecutive 1‑bits in the 32‑bit subnet mask. For example, /25 means the first 25 bits are the network portion and the remaining 7 bits identify hosts within that subnet.
3. Can every IP range be expressed as a single CIDR block?
No. Only ranges that start and end on power‑of‑two boundaries can be represented by one CIDR block. Otherwise, the range must be split into multiple contiguous blocks that together cover the exact interval.
4. How many usable hosts does a /25 subnet have?
A /25 subnet provides 2^(32-25) = 2^7 = 128 total addresses. However, the first address (network) and the last address (broadcast) are reserved, leaving 126 usable IPs for hosts.
How to Use
- Select the conversion mode: CIDR to IPv4 Range, or IPv4 Range to CIDR.
- Enter the CIDR notation (e.g., 192.168.1.0/24) or the start and end IP addresses for the range.
- View the detailed results instantly - network address, broadcast address, subnet mask, and more.