Skip to content

IP Range to CIDR

Convert a start and end address into the smallest set of CIDR blocks.

Quick Tool Overview

The IP Range to CIDR converter turns an arbitrary start and end address into the smallest set of CIDR blocks that covers it exactly — no gap, no overlap — which is what a firewall rule actually needs.

What it does
Converts an address range into CIDR blocks
You give it
A start and an end address
You get back
The smallest exact set of blocks
Best for
Firewall rules, security groups and allowlists
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the IP Range to CIDR

Firewalls, security groups and allowlists take CIDR blocks, and the range you actually need is almost never a single tidy one. Give a start and end address and this produces the smallest set of blocks covering exactly that range — no gap, no overlap.

A range only collapses to one block when it starts on a power-of-two boundary and has a power-of-two length. Anything else needs several, and the algorithm is greedy: at each step it takes the largest block that both begins at the current address and fits inside what is left. The total is shown against the range size so you can confirm the coverage is exact, which is the thing that matters when the output becomes a firewall rule.

Key features of the IP Range to CIDR

Provably minimal

Greedily taking the largest aligned block that fits is optimal for this problem, so no shorter list covers the same range.

Exact coverage

Every block sits entirely inside the range, so the rule never allows an address you did not intend.

Coverage verified

The total of the blocks is compared against the range size, so a mistake would be visible rather than silent.

Explains the alignment

Why a range needs several blocks — CIDR requires a power-of-two size starting on a power-of-two boundary.

Class boundaries ignored

As CIDR does; a range crossing from 10.x into 11.x is decomposed like any other.

How to use the IP Range to CIDR

  1. 1

    Enter the start address

    The first address the range should include.

  2. 2

    Enter the end address

    The last one, inclusive.

  3. 3

    Read the blocks

    The smallest set that covers the range exactly.

  4. 4

    Check the coverage

    The total is compared against the range size, so an error is visible.

Frequently asked questions

Because CIDR blocks must start on a power-of-two boundary and have a power-of-two size. A range from .1 to .254 satisfies neither, so it decomposes into a series of aligned blocks.

Reviews of the IP Range to CIDR

What people who use the IP Range to CIDR think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the IP Range to CIDR. It takes half a minute and no account.

Write the first review

More developer tools