How to use
- Pick a function with the tabs: IP range to CIDR, Merge CIDRs, Compare two CIDRs or List addresses.
- For ranges, write one per line such as
192.168.1.5 - 192.168.1.20. A CIDR or a single address is accepted too. - To merge, paste the CIDRs you plan to put in a firewall or allow list, separated by newlines or commas. You get the shortest list with overlaps and duplicates removed.
- To compare, enter two CIDRs. The tool says whether they are equal, whether one contains the other, or whether they are disjoint, and can test a single address against A.
- Use the copy button on the result box to take the list as is.
What each function does
| Function | Input | Result |
|---|---|---|
| IP range to CIDR | start - end address | the fewest CIDR blocks that cover exactly that range |
| Merge CIDRs | CIDRs, ranges or addresses, many lines | overlaps removed, adjacent blocks combined |
| Compare two CIDRs | two CIDRs | equal, contains, or disjoint |
| List addresses | one CIDR and a count | the first N addresses (up to 4,096) |
IPv4 and IPv6 can be mixed in one list; the output puts IPv4 first. All arithmetic uses BigInt, so 128-bit IPv6 values stay exact.
How it works, with examples
A CIDR block has a power-of-two size and must start at a multiple of that size, so most ranges need several blocks. The tool starts at the first address and repeatedly takes the largest block that is aligned and does not pass the end, which always yields the minimum count.
192.168.1.5 - 192.168.1.20 takes five blocks:
| CIDR | Addresses |
|---|---|
| 192.168.1.5/32 | .5 |
| 192.168.1.6/31 | .6 to .7 |
| 192.168.1.8/29 | .8 to .15 |
| 192.168.1.16/30 | .16 to .19 |
| 192.168.1.20/32 | .20 |
Merging first turns every item into a range, joins ranges that overlap or touch, and then splits the result into minimal CIDRs again. 10.0.0.0/24 and 10.0.1.0/24 become the single block 10.0.0.0/23, and 10.1.2.0/24 disappears inside 10.0.0.0/8. Blocks with a gap such as 172.16.0.0/16 and 172.18.0.0/16 stay separate. Only a pair of sibling blocks can become the next larger block: 10.0.1.0/24 and 10.0.2.0/24 touch, but they do not line up on a /23 boundary, so they stay as two lines.
Input with host bits set (192.168.1.77/24) is rounded down to the network address (192.168.1.0/24) and a note is shown. For a sense of scale:
| Prefix | IPv4 addresses |
|---|---|
| /8 | 16,777,216 |
| /16 | 65,536 |
| /24 | 256 |
| /30 | 4 |
An IPv6 /32 holds 2^96 addresses, which is 79,228,162,514,264,337,593,543,950,336.
Frequently asked questions
Can the merged list be longer than the input?
Converting a range can produce more lines than you typed, because one range often needs several blocks. Merging a CIDR list never does: it returns the shortest list describing the same set of addresses.
Can I use it to shorten firewall rules?
Yes. If an allow or block list has hundreds of lines, merging reduces the rule count. Merging never changes the set of addresses, so the allowed range does not grow. Still, double-check the result before applying it to a device.
How is this different from the IP Subnet Calculator?
The IP Subnet Calculator explains one CIDR in detail (network, broadcast, host range, mask) and splits it into subnets. This tool is built for lists: range conversion, merging many blocks and comparing two blocks.
Does it support IPv6?
Yes. Ranges like 2001:db8::1 - 2001:db8::ffff and CIDRs like 2001:db8::/33 work, and addresses are printed in the compressed RFC 5952 form. For IPv4-mapped conversions see the IPv4 to IPv6 Converter.
Why is the address list capped at 4,096?
A /8 has more than 16 million addresses, which would freeze the page. The total count is always shown, so use the list to inspect the beginning of a block.
To turn the result into firewall rules use the Firewall Rule Generator, and to see an address in binary use the Number Base Converter. Addresses you enter are processed in your browser and never sent to a server.