Skip to content

Minimal exact cover · IPv4 · IPv6

IP range to CIDR calculator.

Give it any start and end address and this IP address to CIDR calculator returns the fewest CIDR blocks that cover the range exactly — no address more, no address less.

Try

Tip: paste 10.0.0.5 - 10.0.3.200 into the first field and both sides fill in.

Covering CIDR blocks

Results appear here as you type.

Why alignment forces multiple blocks

Every CIDR block is a power-of-two run of addresses that starts on a multiple of its own size. A /30 has four addresses, so it can only begin at an address divisible by four.

That constraint is what makes an arbitrary range awkward. Starting at 10.0.0.5 means the first block can only be a /32 — a single address — because 5 is not divisible by anything larger. Once you reach 10.0.0.6 a /31 becomes possible, then a /30 at 10.0.0.8, and the blocks grow until the far end of the range forces them to shrink again.

The result is a characteristic small–large–small staircase, and it is always the minimal answer.

Covering 10.0.0.5 – 10.0.3.200

10.0.0.5/32        1   ← alignment forces a single address
10.0.0.6/31        2
10.0.0.8/29        8
10.0.0.16/28      16
10.0.0.32/27      32
10.0.0.64/26      64
10.0.0.128/25    128
10.0.1.0/24      256
10.0.2.0/24      256
10.0.3.0/25      128
10.0.3.128/26     64
10.0.3.192/29      8
10.0.3.200/32      1   ← and again at the far end

13 blocks · 964 addresses, exactly

Questions people actually ask

Why does one range turn into several CIDR blocks?

A CIDR block must start on an address that is aligned to its own size — a /24 can only begin at .0, a /23 only at an even third octet, and so on. An arbitrary range like 10.0.0.5–10.0.3.200 does not line up with any single boundary, so it has to be covered by a set of differently sized aligned blocks.

Is this the smallest possible set of blocks?

Yes. The result is the minimal exact cover: at each step it takes the largest aligned block that starts at the current address and still fits inside the range, then continues from where that block ends. No smaller set can cover the range exactly.

What if I want a single block that contains the whole range?

That is a different question — the supernet — and it will usually include addresses outside your range. For 10.0.0.5–10.0.3.200 the smallest containing block is 10.0.0.0/22, which covers 1,024 addresses rather than the 964 you asked for. Use the exact cover when writing allow-lists and the supernet when writing routes.

Does it handle ranges given backwards?

It swaps them and tells you it did. Overlapping or adjacent inputs are also merged before the cover is computed, so you never get two blocks describing the same address.

More calculators