DevTools Logo

IPv4 Range Expander

IPv4 Range Expander

Turn an IPv4 address range into the smallest covering CIDR block list — with totals and usable host counts.

Enter the inclusive range boundaries — the smallest covering CIDR blocks compute live.

Try a sample:

Examples

A tidy /24

Input
192.168.1.0 – 192.168.1.255
Output
192.168.1.0/24 · 256 addresses · 254 usable

The range lands on a prefix boundary, so one block covers it exactly and no warning appears.

A split range

Input
10.0.0.5 – 10.0.0.14
Output
10.0.0.5/32 · 10.0.0.6/31 · 10.0.0.8/30 · 10.0.0.12/31 · 10.0.0.14/32

Five minimal blocks cover the ten addresses exactly; the warning notes the range is not a single CIDR.

The whole space

Input
0.0.0.0 – 255.255.255.255
Output
0.0.0.0/0 · 4,294,967,296 addresses · 4,294,967,294 usable

The extreme case collapses to a default route — a single /0 covering every IPv4 address.

About this tool

CIDR notation writes a network as an address plus a prefix length — 192.168.1.0/24 — but real-world address assignments rarely arrive that tidy. You get a first IP and a last IP from a spreadsheet, a firewall log, an abuse report or a procurement form, and every routing table, ACL and whois record wants CIDR blocks. The IPv4 Range Expander bridges exactly that gap: it takes any inclusive start/end pair and computes the smallest set of CIDR blocks that covers the range exactly, with no gaps and no addresses outside the range.

The math behind the result is a greedy greatest-common-prefix split. Starting at the range's first address, the algorithm repeatedly takes the largest block the alignment allows — a block must begin at a multiple of its own size — that still fits inside the remaining range, emits it, and advances past it. When the range sits on a clean boundary, everything collapses into one block: 192.168.1.0 through 192.168.1.255 is exactly 192.168.1.0/24. When it does not, the range splits into the provably minimal list of blocks, and the tool says so with an explicit warning rather than quietly snapping the range outward and inventing addresses you do not own.

Every emitted block carries its network address, prefix length, usable host range and counts, using the conventions network engineers expect: on prefixes /30 and shorter, the network and broadcast addresses are reserved, so a /24 holds 254 usable hosts; a /31 keeps both of its addresses as a point-to-point link (RFC 3021); a /32 is a single host route. The panel also totals the range — addresses, usable hosts, first and last address — so a firewall rule or an IP plan can be sanity-checked at a glance.

All arithmetic is 32-bit unsigned integer math with right-shifts, no floating-point shortcuts and no BigInt, computed entirely on your device — nothing is sent to a server. For what happens inside a single subnet, the Subnet Calculator breaks one prefix into network, broadcast and host details; the IP Address Lookup tells you what a single address means; and the IPv6 Expander handles the same questions in the 128-bit world.

What this tool does not do

  • IPv4 only — 32-bit addresses; IPv6 ranges need a dedicated expander because 128-bit math overflows plain-number arithmetic.
  • The tool expands ranges, it does not shrink or merge existing CIDR lists — supernetting an existing block set is a different operation.
  • Usable-host counts follow the standard reservation convention; some providers route differently, so confirm with your operator for exotic setups.

How to use this tool

  1. Enter the start address

    Paste the first IPv4 address of the range — the lowest one. Validation flags non-octets, values over 255 or missing dots immediately.

  2. Enter the end address

    Paste the last address of the range — the highest one. The expansion computes live as you type, no submit button.

  3. Read the block list

    Each CIDR block shows its network address, prefix, usable host range and counts; the panel totals addresses and usable hosts for the whole range.

  4. Copy the CIDR list

    Copy the blocks as a newline-separated list for firewall rules, routing tables or documentation — and note the warning when the range needs more than one block.

Use cases

Writing firewall and ACL rules

Convert customer-assigned ranges from tickets into exact CIDR lists so allow/deny rules cover precisely the addresses you own — no more, no less.

Planning IP allocations

Check whether a requested range fits one prefix or needs several before carving it into the address plan, with usable-host counts for each block.

Cleaning up whois and abuse reports

Turn the loose first–last address pairs in registry records and spam reports into routing-table-ready CIDR notation.

What each result field means

FieldMeaning
CIDR blockNetwork address / prefix length — the standard routing notation
Network addressFirst address of the block, reserved for the network itself (prefix ≤ /30)
Usable hostsAssignable addresses: total minus network + broadcast (RFC 3021 keeps both on /31)
Total addresses2^(32 − prefix) per block; summed across blocks equals the range size
Single blockTrue when one CIDR block covers the range exactly — the tidy case
WarningSet when the range does not align to a single CIDR boundary and splits into several blocks

The expansion is minimal: no block list that covers the range exactly can use fewer blocks.

Common mistakes

Mistake:Round-tripping through a single CIDR and silently over-covering.

Fix:Snapping 192.168.1.1–192.168.1.254 up to 192.168.1.0/24 grants .0 and .255 too — addresses you may not control. Use the multi-block expansion and keep the warning honest.

Mistake:Counting every address as usable.

Fix:On prefixes /30 and shorter the network and broadcast addresses are reserved — a /24 holds 254 hosts, not 256. Only /31 (RFC 3021) and /32 keep all their addresses.

Mistake:Reversing start and end.

Fix:The expander rejects a start greater than the end instead of producing an empty or wrapped range — double-check which boundary is which when copying from logs.

Frequently asked questions

Why does one range expand into several CIDR blocks?

A CIDR block must start at an address that is a multiple of its own size, so a range that begins or ends off those boundaries cannot be a single block. The tool splits the range greedily — largest aligned block first — which produces the provably minimal list covering the range exactly, and raises a warning whenever more than one block is needed. The warning is information, not an error: it tells you the range does not correspond to one clean network assignment.

How many usable hosts does a CIDR block contain?

For prefixes /30 and shorter, subtract two from the total: the first address is the network identifier and the last is the broadcast address, so a /24 holds 256 addresses but 254 usable hosts. A /31 keeps both of its addresses as a point-to-point link under RFC 3021, and a /32 is a single host route with exactly one usable address. The tool applies these conventions per block and sums them for the whole range, so the totals you copy are the ones a network engineer expects.

What does "greatest common prefix" splitting mean here?

It is the greedy algorithm behind the block list: starting at the range's first address, take the largest block whose size divides that address evenly and which still fits inside the remaining range, emit it, and repeat from the next address. Because each step grabs the biggest legal block, the resulting list is minimal — no shorter list can cover the same range exactly. This is the same approach other IP calculators use, so results match block-for-block.

Can I use this tool for IPv6 ranges?

Not here — this expander is IPv4-only and validates dotted-quad addresses of four octets. IPv6 ranges live in 128-bit space, which needs different arithmetic, and the natural counterparts are the IPv6 Expander for notation and the Subnet Calculator for prefix math. For IPv4, though, the whole calculation runs as 32-bit unsigned integer operations in your browser, so ranges of any size — including the full 0.0.0.0–255.255.255.255 space, which collapses to 0.0.0.0/0 — are handled instantly and locally.

Why should I not just round the range up to one CIDR?

Rounding outward invents addresses: expanding 192.168.1.1–192.168.1.254 to 192.168.1.0/24 silently adds 192.168.1.0 and 192.168.1.255, which may belong to someone else's infrastructure or to reserved functions. In firewall rules and route announcements, over-covering is a security and correctness bug, not a rounding detail. Use the multi-block expansion when the warning appears, and keep the copy exactly the addresses you actually own.

Does the tool send my IP ranges to a server?

No. Parsing, validation and the block-splitting algorithm all run as local arithmetic in your browser tab, and nothing is transmitted anywhere. The start address persists only in your browser's local storage between visits so the form refills on return; the Clear control on the restored-input notice removes both the field and the saved copy. There is no server-side logging because no server participates in the calculation.

References & standards