IP Range Calculator

Enter a start and end IPv4 address to see the total address count and the CIDR blocks that cover the range.

Input

Results

First IP
—
Last IP
—
Total Addresses
—

Covering CIDR Blocks

CIDR BlockSize

Overview

The IP Range Calculator takes a start and end IPv4 address and tells you how many addresses the range contains and which CIDR blocks exactly cover it.

That second part is the practical one. Vendor documents, DHCP scopes, and abuse reports often describe address space as "from A to B", but firewalls, route tables, cloud security groups, and allow-lists want CIDR prefixes. This tool converts one into the other.

How It Works

Not every range is a single CIDR block. A block of size 2n must begin on an address divisible by 2n. The calculator therefore works through the range with a simple greedy algorithm: starting at the first address, it picks the largest block that both begins at an aligned boundary and still fits inside the remaining range, records it, moves to the address after that block, and repeats until the end of the range is reached.

The result is the minimal list of CIDR blocks whose union is exactly the range — no address outside the range is included and none inside is missed. Counts are computed arithmetically, so large ranges are handled instantly; the tool never lists individual addresses.

How to Use the IP Range Calculator

  1. Enter the first address in Start IP and the last address in End IP. The end must be equal to or greater than the start.
  2. Press Calculate.
  3. Read the total address count and the table of covering CIDR blocks. Each row can be used directly as one entry in a firewall or route configuration.
  4. Copy the results to your clipboard if you need to paste them elsewhere.

Worked Example

192.168.1.10 to 192.168.1.100

A vendor tells you its servers occupy 192.168.1.10 through 192.168.1.100 and you must allow exactly that range.

Input

Start IP: 192.168.1.10
End IP:   192.168.1.100

Output

Total addresses: 91
192.168.1.10/31    2 addresses
192.168.1.12/30    4 addresses
192.168.1.16/28    16 addresses
192.168.1.32/27    32 addresses
192.168.1.64/27    32 addresses
192.168.1.96/30    4 addresses
192.168.1.100/32   1 address

The range holds 91 addresses (100 − 10 + 1). It starts at .10, which is not aligned to a large block, so the algorithm begins with a small block (192.168.1.10/31), then works up through aligned blocks — 192.168.1.12/30, 192.168.1.16/28, 192.168.1.32/27, 192.168.1.64/27 — and finishes with progressively smaller ones to land exactly on .100. That is 7 blocks in total; no single prefix could describe this range without including addresses outside it.

Compare a range that happens to be aligned: 192.168.1.0 to 192.168.1.255 needs just 1 block, 192.168.1.0/24.

Interpreting Results

Total addresses
End minus start plus one. It counts every address in the range, including any that would be a network or broadcast address in a conventional subnet.
Number of blocks
A single block means the range is perfectly aligned. More blocks mean misalignment; consider whether the range can be widened to a single prefix if allowing a few extra addresses is acceptable.
Block sizes
Each block's size is a power of two. The sum of all sizes equals the total address count.

Troubleshooting

"Start IP must be less than or equal to End IP."
Swap the two values, or check for a typo in an octet.
"Invalid IPv4 address."
Use dotted-decimal with four octets between 0 and 255 and no leading zeros.
My firewall accepts only one CIDR per rule.
Create one rule (or one list entry) for each block in the table, or widen the range to a single aligned prefix if the extra addresses are acceptable.

Limitations and Accuracy

  • IPv4 only.
  • Pathologically fragmented ranges can produce many blocks; the tool stops after roughly 4,096 blocks and says so when it does.
  • The tool describes address arithmetic only. It does not tell you who owns the range or whether the addresses are public or private.

Data Handling

Runs in your browser. What you enter is processed on your device and is not sent to NetEngToolkit’s servers or to any third party.

Frequently Asked Questions

Why can't a range like .10 to .100 be a single CIDR?

Because CIDR blocks are aligned powers of two. No single block starts at .10 and ends at .100 without also including addresses outside that span.

Is the result the smallest possible list?

Yes. The greedy "largest aligned block that fits" method produces the minimal set of CIDR blocks for a contiguous range.

What if I have several separate ranges?

Run each range separately. Combining blocks across ranges (route aggregation) is a different operation and depends on whether they are contiguous.