TOOLTIKI Lovable tool, really free
Developer Addressing

IP range to CIDR

8 blocks
192.168.1.10/31192.168.1.12/30192.168.1.16/28192.168.1.32/27192.168.1.64/26192.168.1.128/26192.168.1.192/29192.168.1.200/32

Calculated in your browser · nothing is looked up or uploaded

Local · exact cover, never wider than asked
Advertisement
320 × 100

Converts a start-and-end address range into the smallest set of CIDR blocks that covers it exactly — no more, no fewer.

How to use the ip range to cidr

1 Enter the first and last address.
2 Read the CIDR blocks that exactly cover the range.
3 Copy them into your firewall or route table.

Firewalls, route tables and cloud security groups take CIDR blocks, and people think in ranges. "Allow 192.168.1.10 through 192.168.1.200" has to become a list of prefixes, and doing it by hand is error-prone in the direction that matters: it is easy to produce a block that covers more than you meant, which quietly opens access you did not intend.

The algorithm is greedy and it is exact. At each step it takes the largest block that both starts at the current address — a block must be aligned to its own size — and does not run past the end. Then it moves to the address after that block and repeats. The result is provably the minimum number of blocks, and their sizes always add up to exactly the number of addresses in the range.

That alignment constraint is why an apparently simple range can need many blocks. 192.168.1.1 to 192.168.1.6 is six addresses and takes four blocks, because 1 is odd and can only start a /32. Ranges that start and end on power-of-two boundaries collapse to a single block, which is a good argument for choosing them when you get to.

Questions

A block must be aligned to its own size. A range starting on an odd address can only begin with a /32.

RFC 4632 — Classless Inter-domain Routing
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING