CIDR ↔ IP Range Converter
Bidirectional converter: expand a CIDR block into an exact IP range, or compute the minimal CIDR set for any IP span.
Boundary Alignment & CIDR Range Mathematics
A CIDR block is defined by a starting IP address and a prefix length representing the number of shared leading bits. Because prefixes represent binary bitmasks, every CIDR block has a fixed size equal to 2^(32 - prefix).
Crucially, a CIDR block cannot begin on any random IP. It must align to its boundary—meaning the numerical integer value of the starting IP address must be an exact multiple of the block size:
When you input an arbitrary range like 192.168.1.10 – 192.168.1.150, our engine uses a greedy binary tree partitioning algorithm to break the range down into the exact, minimal collection of validly aligned CIDR blocks with zero overlapping space and zero extraneous addresses.
Related Network Utilities
Frequently Asked Questions
Why does an arbitrary IP range frequently require multiple CIDR blocks?
In CIDR notation, a block must have a size that is a power of 2 (2, 4, 8, 16, 32...) and must start on an address that is an exact multiple of that block size (boundary alignment). If an IP range starts on an odd number or spans a non-power-of-two quantity of addresses (e.g. 192.168.1.50 to 192.168.1.100), it cannot be represented by a single CIDR block without either excluding requested IPs or including unwanted extra space. It must be decomposed into multiple contiguous CIDR blocks.
How does the Range-to-CIDR conversion algorithm work?
The algorithm iteratively finds the largest power-of-two block that aligns with the current start IP and does not exceed the designated end IP. It emits that CIDR block, advances the start IP to the next unallocated boundary, and repeats until the entire range is covered with zero waste.
When should I convert an IP range to CIDR blocks?
Converting IP ranges to CIDRs is standard practice when configuring cloud security groups (AWS VPC Security Groups, Azure Network Security Groups NSGs), cloud routing tables, BGP route filters, and web application firewall (WAF) IP allowlists, which almost universally require CIDR format instead of hyphenated IP ranges.
Need this designed for a real production environment?
Consult with Gurinder Singh and vetted cloud specialists for Azure Landing Zones, AWS VPC peering, and hybrid connectivity.