IPv4 range to CIDR
Turn an inclusive IPv4 address range into the smallest exact set of CIDR blocks.
How it works & useful details
How it works & limits
Enter the first and last IPv4 addresses, inclusive. The result is the smallest set of aligned CIDR blocks covering exactly that range. No address outside your range is included.
Both addresses must be strict dotted decimal. The full IPv4 space is supported; a range produces at most 62 blocks. Select a block to see its boundaries. Saved text has one CIDR per line.
Your working space
Explore the live view, then save copyable text and a downloadable file. Everything is calculated locally. Inputs are not stored; refreshing clears them.
These tools inspect address notation and ranges. They do not contact addresses, check availability or establish connectivity.
About this tool
IPv4 range to CIDR converts an inclusive start and end address into the smallest exact set of CIDR blocks that covers the range. It is the tool for translating a firewall range into network notation.
The result never covers addresses outside the range and never omits one inside, so the block list is a precise substitute. Addresses are calculated locally.
How to use it
- Enter the first and last address of the range.
- Run the conversion to produce the CIDR blocks.
- Check the block list and covered address count.
- Copy the blocks into your rule or configuration.
Worked example
The range 192.168.1.10 – 192.168.1.130 (121 addresses) needs seven CIDR blocks to cover it exactly:
192.168.1.10/31 (2)
192.168.1.12/30 (4)
192.168.1.16/28 (16)
192.168.1.32/27 (32)
192.168.1.64/26 (64)
192.168.1.128/31 (2)
192.168.1.130/32 (1)The blocks grow as they move toward an aligned boundary, then shrink again to stop exactly at the last address. 2 + 4 + 16 + 32 + 64 + 2 + 1 = 121, with no address outside the range.
Why ranges rarely map to one block
A single CIDR block always contains a power of two addresses and starts on a multiple of its size. Arbitrary ranges, such as DHCP pools, provider allocations listed as start–end, or geolocation database rows, seldom meet both conditions, so they break into several blocks. The worst case for IPv4 is 62 blocks.
Firewalls, cloud security groups, and routing configurations usually require CIDR notation, so this conversion is a common step when importing ranges. If you control the range, choose aligned boundaries, such as .0–.127 instead of .10–.130, to keep rule lists short.
Frequently asked questions
Why are several blocks returned instead of one?
CIDR blocks are powers of two. A range that is not itself a power-of-two block must be expressed as a sum of exact blocks.
What if the start is after the end?
The input is rejected with an explanation rather than being silently swapped.
Are IPv6 ranges supported?
No. This tool targets IPv4 ranges.
Can I merge the output with other blocks?
Yes. Paste the result together with other CIDRs into the CIDR aggregator, which combines anything that is adjacent and aligned.
