Too Much Tools logoToo Much Tools

IPv4 Range Expander

Find the smallest CIDR block that fully contains a start and end IPv4 address, locally.

Local, Runs entirely in your browser, your data never leaves your device.
Loading tool…

Turn a start-end address range into one CIDR block

Given a start and end IPv4 address, this tool finds the smallest single CIDR block that fully contains both, by locating the highest bit position where the two addresses differ and using it as the prefix length. It's useful when a firewall rule or access list is written as a range, like 192.168.1.5-192.168.1.20, and you need one CIDR block for a router ACL or cloud security group. The whole calculation is a few bitwise operations on two addresses, done locally.

How to use the IPv4 Range Expander

  1. Enter the start address of the range in the first field.
  2. Enter the end address of the range in the second field.
  3. Read the resulting CIDR block, prefix length and netmask.
  4. Compare the block start and end addresses to your input range to see how far it was extended.

The output block is always the smallest single CIDR that covers both addresses. If the range doesn't already sit on a power-of-two boundary, the block extends outward to the nearest network and broadcast address, so the result can be wider than the range you entered.

Frequently asked questions

how do I find the CIDR for a range of IP addresses?
Enter the first and last address of the range. The tool XORs them to find the highest bit where they differ, uses that to set the prefix length, then reports the smallest CIDR block containing both addresses.
why is the resulting block bigger than my original range?
A CIDR block must start on a network address and end on a broadcast address for its prefix length. If your range doesn't already align to that boundary, the smallest containing block extends past your original start or end.
does it matter which address I enter first, start or end?
No, the tool sorts the two addresses before computing the block, so entering them in either order produces the same CIDR result.
can I use this to check if two subnets can be summarized into one?
Yes, enter the first address of one subnet and the last address of the other. The resulting prefix is the summary route, though you should confirm it doesn't also cover addresses outside your intended subnets.