IP range to CIDR converter

Paste one range per line, like 10.0.0.1 - 10.0.0.254, and get the CIDR blocks that cover exactly those addresses — nothing more, nothing less. Useful for firewall rules, allow lists, cloud security groups and nginx deny lists that only take CIDR notation.

4 CIDR blocks covering 1,286 addresses

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste your ranges, one per line. Ranges, single addresses and CIDR blocks can be mixed.
  2. Leave Merge overlapping ranges on to get one clean, sorted list, or turn it off to keep each line separate.
  3. Copy the CIDR blocks into your firewall, security group or server config. The line under the result shows how many blocks and addresses there are.

How it works

Each address is treated as a number (32 bits for IPv4, 128 bits for IPv6). Starting at the first address of the range, the tool picks the largest block that:

  • is aligned — the start address is divisible by the block size, which is what a /n prefix requires;
  • fits — the block’s last address is not past the end of the range.

It writes that block, moves to the address after it and repeats until the range is covered. A block of 2^k addresses has the prefix length 32 − k for IPv4 (128 − k for IPv6).

Worked example

Range 10.0.0.1 – 10.0.0.254 (all of 10.0.0.0/24 except the network and broadcast addresses):

  • 10.0.0.1 is odd, so only a single address fits: 10.0.0.1/32;
  • 10.0.0.2 is divisible by 2: 10.0.0.2/31; then 10.0.0.4/30, 10.0.0.8/29, 10.0.0.16/28, 10.0.0.32/27 and 10.0.0.64/26;
  • 10.0.0.128 could start a /25, but that would reach 10.0.0.255, past the end, so it gets 10.0.0.128/26; then 10.0.0.192/27, 10.0.0.224/28, 10.0.0.240/29, 10.0.0.248/30, 10.0.0.252/31 and 10.0.0.254/32.

That is 14 blocks for 254 addresses. The range 10.0.0.0 – 10.0.0.255 would be just one block, 10.0.0.0/24.

Tips

  • Ranges that end in .0 and .255 convert best. A range that starts or ends in the middle of a block always needs extra small blocks.
  • Check the address count. If the summary shows more addresses than you expected, two lines probably overlap or a typo widened a range.
  • To see the network, mask and host range of a single block, use the IP subnet calculator.

Frequently asked questions

Why does one range become several CIDR blocks?

A CIDR block always has a power-of-two size (1, 2, 4, 8 … addresses) and must start at an address divisible by that size. A range like 192.168.1.10 – 192.168.1.15 is six addresses starting at 10, so it splits into 192.168.1.10/31 (two addresses) and 192.168.1.12/30 (four).

Is the result the shortest possible list?

Yes. At each step the tool takes the largest block that starts at the current address and does not go past the end of the range. That greedy choice gives the minimum number of CIDR blocks for a range, with no address left out and none added.

What input formats are accepted?

One item per line (commas and semicolons also separate items): a range with a dash (10.0.0.1-10.0.0.9 or 10.0.0.1 – 10.0.0.9), two addresses separated by a space, a single address (it becomes a /32 or /128) or a CIDR block. IPv4 and IPv6 can be mixed, but one range must not mix both.

What does merging do?

With merging on, ranges are sorted and overlapping or touching ones are joined before conversion, so 10.1.0.0/25 and 10.1.0.128/25 come out as one 10.1.0.0/24. Turn it off to convert each line on its own, in the order given.

More in Developer

All tools in this category: Developer ·Updated November 7, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.