Developer tools

IP Range to CIDR Converter

IP Range to CIDR Converter

Convert a start and end IPv4 address into the minimal list of CIDR blocks.

About this tool

About IP Range to CIDR Converter

Firewalls, cloud security groups, nginx allow rules and most allowlists want CIDR notation, but ranges are often handed over as a start and an end address, such as 192.168.1.10 to 192.168.1.20 from a vendor or a DHCP pool. Most ranges do not line up with a single block, and rounding to a bigger block would let in addresses you never meant to allow. Enter the first and last address and the converter returns the smallest possible set of CIDR blocks that covers exactly that range and nothing outside it: here 192.168.1.10/31, 192.168.1.12/30, 192.168.1.16/30 and 192.168.1.20/32. Each block is listed with its first and last address and size, the full list copies with one click, and the table downloads as CSV. It handles every edge from a single address up to the entire 0.0.0.0/0 space. You can switch to the subnet details or splitter mode at any time, and nothing leaves your browser.

Built and maintained by Abhi JainUpdated

How to Convert an IP Range to CIDR

  1. 1

    Enter the range

    Type the first address in Start IP and the last in End IP. Both are included.

  2. 2

    Read the blocks

    The table lists the minimal CIDR blocks with their first and last addresses and sizes.

  3. 3

    Copy

    Click Copy CIDR list for firewall rules or download the CSV.

IP Range to CIDR Converter: questions and answers

Why does one range give several CIDR blocks?

A CIDR block must start on a multiple of its size, and its size is a power of two. A range that starts or ends off those boundaries has to be built from several smaller blocks to avoid including extra addresses.

Is the result the smallest possible list?

Yes. At each step the converter takes the largest aligned block that starts at the current address and still fits inside the range, which is the standard greedy method and gives the minimal set.

How do I convert a range like 10.0.0.0 to 10.0.255.255?

When the range starts on a boundary and spans a power of two, it is a single block: 10.0.0.0 to 10.0.255.255 is 65,536 addresses, which is 10.0.0.0/16.

Can I enter a single IP?

Yes. Use the same address for start and end and you get a /32.

More Subnet Calculator presets