CIDR calculator

Turn an IPv4 address range into the fewest CIDR blocks that cover it exactly, or merge a list of blocks into the shortest one. It runs in your browser: nothing you type is sent anywhere.

Range to CIDR

Two addresses, split by a hyphen or a space.

BlockFirst addressLast addressAddresses
10.0.0.1/3210.0.0.110.0.0.11
10.0.0.2/3110.0.0.210.0.0.32
10.0.0.4/3110.0.0.410.0.0.52
10.0.0.6/3210.0.0.610.0.0.61

4 blocks, 6 addresses.

Aggregate a list

Lines, commas or semicolons between blocks. A bare address is a /32.

BlockFirst addressLast addressAddresses
10.0.0.0/2310.0.0.010.0.1.255512
192.168.1.0/24192.168.1.0192.168.1.255256

5 entries merged into 2 blocks, 768 addresses.

192.168.1.5/24 has host bits set, so it was read as 192.168.1.0/24.

How the blocks are worked out

What each tool keeps exact, and what it does with input that is not quite a block.

The fewest blocks, nothing extra

A CIDR block starts on a multiple of its own size, so most ranges need several. Each tool picks the largest block that fits at every step, which gives the shortest list that covers the addresses exactly and never one more.

Overlaps and duplicates

A block listed twice, or inside another, counts once. Blocks that touch are joined only where the result is still exact: two /25s make a /24 when they are its two halves.

Host bits are cleared

An entry like 10.0.0.5/24 names an address inside 10.0.0.0/24 rather than a block. It is read as that block, and the result says so under the table.

Firewall and address lists

A shorter list means fewer rules to match. Paste the merged blocks into a MikroTik address list or an access list; RouterOS also takes a range like 10.0.0.1-10.0.0.6 as it is.

One block in detail

For the netmask, broadcast address and usable hosts of a single block, use the subnet calculator.

Bill the subscribers behind those blocks.

Centipid assigns addresses, provisions MikroTik and collects the payment that keeps them online.