IP range to CIDR converter

Firewalls and allow lists usually want CIDR blocks; this splits any range into the exact blocks that cover it with nothing extra.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter start address and end address.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

From the start address take the largest block of 2^k addresses that is aligned (start divisible by 2^k) and does not pass the end, then move on and repeat. Prefix = 32 minus k.

Example

Inputs: Start address = 10.0.0.1, End address = 10.0.0.10. Result: CIDR blocks: 10.0.0.1/32 10.0.0.2/31 10.0.0.4/30 10.0.0.8/31 10.0.0.10/32; Number of blocks: 5; Addresses covered: 10.

10.0.0.1
10.0.0.1/32
10.0.0.2/31
10.0.0.4/30
10.0.0.8/31
10.0.0.10/32

Limits and caveats

  • IPv4 only.
  • Unaligned ranges produce several blocks; that is the minimum possible, not an error.

Questions about this tool

Why is the result not always one block?

A CIDR block must start on a boundary divisible by its size, so a range that starts or ends mid-block needs several.

Do the blocks cover addresses outside my range?

No. They cover exactly the range from start to end.

What is the most blocks a range can need?

Any IPv4 range needs at most 62 blocks.