IP range to CIDR converter

Enter a first and last address to get the fewest CIDR blocks that cover exactly that range, nothing more and nothing less.

IP range to CIDR converter

Loading the ip range to cidr converter. It runs in your browser.

How it works

Starting at the first address, the converter takes the largest block that starts there and does not pass the end, then repeats. A range that does not line up with block boundaries needs several blocks: 192.0.2.5 to 192.0.2.20 becomes five.

Uses

Firewall and cloud security rules, web server allow lists and route filters usually accept CIDR only. Registry records and logs often give ranges.

Questions

Does it work for IPv6?
Yes, for any range where both ends are the same version.

References