IP range to CIDR
The fewest CIDR blocks for an IP range, and back.
One per line, IPv4 or IPv6: a range, an address or a CIDR block.
Try
About this tool
- Runs in
- your browser
- Your input sent to our servers
- Nothing
- Kept on this device
- nothing
More in the privacy policy.
How to use it
- 01Type or paste ranges, one per line: 192.168.1.10 - 192.168.1.20 (a dash, "to", a comma or a space between the ends), a single address or a CIDR block (several blocks can share a line, separated by commas). Or pick one under Try.
- 02The fewest CIDR blocks that cover them appear as you type, with how many addresses they hold. Choose CIDR → range to go the other way.
- 03Copy the result, or press Swap to turn it back into ranges.
Related tools
Questions
Why are there several blocks for one range?
A CIDR block always starts on a multiple of its size, so most ranges need a few blocks of different sizes. 192.168.1.10 - 192.168.1.20 needs 4: 192.168.1.10/31, 192.168.1.12/30, 192.168.1.16/30, 192.168.1.20/32. The list is the shortest one that covers exactly the range, no address more or less.
What happens with several lines?
They are merged first: ranges that overlap or touch become one, so the result is the shortest list for all of them together, which is what a firewall rule or an allow list wants. CIDR → range does the same: 10.0.0.0/25 and 10.0.0.128/25 become 10.0.0.0 - 10.0.0.255. Untick Merge overlapping lines to get one result per line instead, in the order you typed them.
Why is “10.0.0.0 255.255.255.0” refused?
With only a space between them, the second address could be a subnet mask or the end of a range, and the two give very different blocks. Write 10.0.0.0/24 for the subnet, or put a dash between the ends of a range.
Does it work with IPv6?
Yes, with exact maths for the whole 128-bit space. IPv4 and IPv6 lines can be mixed; the IPv4 results come first. Each range needs both ends in the same version.
Is my list sent anywhere?
No. It’s worked out in your browser as you type. It isn’t sent to our servers, put into the page address or saved.