BYTETOOLS

IP Range to CIDR Converter

Convert any start–end IP range into the smallest possible set of CIDR blocks. Ideal for firewall rules and route summaries — free and fully in-browser.

91
Addresses in range
7
CIDR blocks needed

Minimal CIDR blocks

CIDR blockFirst addressLast addressAddresses
192.168.1.10/31192.168.1.10192.168.1.112
192.168.1.12/30192.168.1.12192.168.1.154
192.168.1.16/28192.168.1.16192.168.1.3116
192.168.1.32/27192.168.1.32192.168.1.6332
192.168.1.64/27192.168.1.64192.168.1.9532
192.168.1.96/30192.168.1.96192.168.1.994
192.168.1.100/32192.168.1.100192.168.1.1001

What is the IP Range to CIDR Converter?

This IP Range to CIDR converter takes an arbitrary start and end IPv4 address and produces the minimal list of CIDR blocks that covers exactly that range — no more, no less.

  • Provably minimal CIDR block set for any start–end range
  • Shows each block's boundaries and address count
  • Reports total addresses and number of blocks needed
  • Clear error when the start address is above the end
  • One-click copy of the block list in plain CIDR notation
  • 100% local computation — nothing leaves your browser

How to use the IP Range to CIDR Converter

  1. 1

    Enter the first IP address of the range.

  2. 2

    Enter the last IP address of the range.

  3. 3

    Review the minimal CIDR blocks in the results table.

  4. 4

    Click Copy blocks to paste the list into your firewall or ACL config.

About the IP Range to CIDR Converter

This IP Range to CIDR converter takes an arbitrary start and end IPv4 address and produces the minimal list of CIDR blocks that covers exactly that range — no more, no less. Ranges rarely align to clean power-of-two boundaries, so a range like 192.168.1.10–192.168.1.100 needs several blocks; this tool finds the provably smallest set.

It works by repeatedly taking the largest block that is both aligned at the current start address and small enough to fit in what remains — the same greedy algorithm used by routing and firewall tooling. Each resulting block is listed with its first address, last address and size.

It is perfect for building firewall rules, cloud security groups and ACLs from ranges given to you by providers. Everything runs locally in your browser with 32-bit integer math, so your network data stays private.

Frequently asked questions

How do I convert an IP range to CIDR notation?

Walk from the start address: take the biggest power-of-two block that starts exactly there and does not overshoot the end, emit it, then continue from the next address. Repeating this until the range is covered yields the minimal CIDR set — exactly what this tool automates.

Why does my range need more than one CIDR block?

CIDR blocks must be power-of-two sized and aligned to their size. A range like 10.0.0.5–10.0.0.6 crosses an alignment boundary, so no single block matches it exactly — it needs 10.0.0.5/32 and 10.0.0.6/32. Odd starts and ends generally cost extra blocks.

Is the result really the minimum number of blocks?

Yes. The greedy largest-aligned-block algorithm is optimal for this problem: at each step no valid CIDR block can cover more of the remaining range than the one chosen, so no shorter list exists that covers exactly the same addresses.

Can I use the output directly in firewall rules?

Yes — the copy button exports plain CIDR notation, one block per line, which is the format accepted by iptables, cloud security groups, nginx allow/deny lists and most router ACL syntaxes.

Does the range include both the start and end addresses?

Yes, the range is inclusive on both ends. The generated blocks cover the start address, the end address and everything between them, and nothing outside.

Related tools