Skip to content

IPv4 range to CIDR

Turn an inclusive IPv4 address range into the smallest exact set of CIDR blocks.

Exact range coverage7 CIDR blocks
Addresses covered121
Extra addresses0
192.168.1.10/31192.168.1.10 → 192.168.1.112 addresses · /31

Select any block to inspect its inclusive range. Every address is covered exactly once.

The list is suitable for systems that accept CIDR notation. Check their address-family and rule limits before use.

Processed on your device

How it works & useful details

How it works & limits

Enter the first and last IPv4 addresses, inclusive. The result is the smallest set of aligned CIDR blocks covering exactly that range. No address outside your range is included.

Both addresses must be strict dotted decimal. The full IPv4 space is supported; a range produces at most 62 blocks. Select a block to see its boundaries. Saved text has one CIDR per line.

Your working space

Explore the live view, then save copyable text and a downloadable file. Everything is calculated locally. Inputs are not stored; refreshing clears them.

These tools inspect address notation and ranges. They do not contact addresses, check availability or establish connectivity.

About this tool

IPv4 range to CIDR converts an inclusive start and end address into the smallest exact set of CIDR blocks that covers the range. It is the tool for translating a firewall range into network notation.

The result never covers addresses outside the range and never omits one inside, so the block list is a precise substitute. Addresses are calculated locally.

How to use it

  1. Enter the first and last address of the range.
  2. Run the conversion to produce the CIDR blocks.
  3. Check the block list and covered address count.
  4. Copy the blocks into your rule or configuration.

Worked example

The range 192.168.1.10 – 192.168.1.130 (121 addresses) needs seven CIDR blocks to cover it exactly:

192.168.1.10/31    (2)
192.168.1.12/30    (4)
192.168.1.16/28    (16)
192.168.1.32/27    (32)
192.168.1.64/26    (64)
192.168.1.128/31   (2)
192.168.1.130/32   (1)

The blocks grow as they move toward an aligned boundary, then shrink again to stop exactly at the last address. 2 + 4 + 16 + 32 + 64 + 2 + 1 = 121, with no address outside the range.

Why ranges rarely map to one block

A single CIDR block always contains a power of two addresses and starts on a multiple of its size. Arbitrary ranges, such as DHCP pools, provider allocations listed as start–end, or geolocation database rows, seldom meet both conditions, so they break into several blocks. The worst case for IPv4 is 62 blocks.

Firewalls, cloud security groups, and routing configurations usually require CIDR notation, so this conversion is a common step when importing ranges. If you control the range, choose aligned boundaries, such as .0–.127 instead of .10–.130, to keep rule lists short.

Frequently asked questions

Why are several blocks returned instead of one?

CIDR blocks are powers of two. A range that is not itself a power-of-two block must be expressed as a sum of exact blocks.

What if the start is after the end?

The input is rejected with an explanation rather than being silently swapped.

Are IPv6 ranges supported?

No. This tool targets IPv4 ranges.

Can I merge the output with other blocks?

Yes. Paste the result together with other CIDRs into the CIDR aggregator, which combines anything that is adjacent and aligned.