IP & Subnet Tools

IP range to CIDRwith exact coverage

Enter inclusive endpoints or a list of ranges. Get the smallest exact CIDR set without adding addresses.

IP range to CIDR

IP range input

Exact CIDR blocks

Addresses are processed in this browser; no network lookup or upload is performed.

Coverage and input rules

Exact coverage only. Overlapping and adjacent ranges are merged within each IP version; gaps stay excluded.

One IP or start-end per line. Use an ASCII hyphen; blank lines are ignored.

Up to 100 nonempty ranges and 65,536 input characters. Results appear 100 blocks at a time.

Input changed. Convert again before exporting.

IP range to CIDR helps when an allowlist gives you first and last addresses but the destination accepts prefixes. A convenient single supernet can quietly include addresses outside that list.

Start with the nonaligned example to see where prefix boundaries fall. For batches, compare the input range count with the merged interval count before taking the result into a rule editor.

Why use IP range to CIDR?

Keep the intended address set visible while changing its notation.

Cover the interval, including its edges

IP range to CIDR splits a nonaligned interval into several blocks instead of expanding it. Each block shows its first address, last address and exact size so you can check the edges.

A selected interval partitioned into aligned blocks with outside addresses left unselected

Merge overlap without filling gaps

Two overlapping ranges should not produce duplicate rules. The batch engine unions ranges of the same version, keeps disjoint gaps and then calculates the minimal CIDR blocks for that union.

Overlapping intervals merge while an unselected gap remains between separate groups

Check the endpoints before exporting

01

Use a complete address at each end

The list accepts one address or start-end per nonempty line. Both endpoints are inclusive; use an ordinary hyphen rather than a typographic dash.

  • Different rows may use different IP versions, but a single range cannot.
02

Control when the result refreshes

Auto conversion waits 350 ms after an edit. Turning it off cancels pending work and reveals the convert button.

  • Ctrl/Cmd + Enter runs the current input; changed inputs disable exports immediately.
03

Review the whole set

The screen adds 100 blocks at a time. Copy and both downloads always contain every block, including those not yet shown.

  • TXT is one CIDR per line. JSON also includes boundaries and exact decimal counts as strings.

From inclusive ranges to reusable prefixes

Both address families

The IP range converter accepts strict dotted IPv4, compressed IPv6 and IPv4 embedded in IPv6. IPv6 range to CIDR uses integer arithmetic throughout, including values larger than JavaScript’s safe integer range.

A deterministic batch union

Duplicate, overlapping and adjacent input intervals are merged separately for IPv4 and IPv6. Output is sorted by address, with IPv4 first; no output block straddles a gap.

Counts that describe coverage

Counts include every address, without subtracting network or broadcast addresses. A /31 has two addresses, a /32 or /128 has one, and the IPv6 /0 count is kept intact in JSON.

Accepted syntax and deliberate limits

Exact sets, never an oversized supernet
There is no “one block at any cost” mode. If the range cannot fit one prefix exactly, the result contains several CIDRs. Prefix output represents addresses, not a verdict that every address is routable.
Bare addresses only
CIDR input, hostnames, URLs, ports, brackets, zone IDs, comments, comma-separated lists and wildcards are rejected. IPv4 leading zeros are rejected; embedded IPv4 remains IPv6 and is printed in compressed hexadecimal notation.
The whole batch must be valid
A reversed interval, mixed-version endpoint pair or malformed line stops the entire conversion. The input stays intact and the error points to its line. No partial list is made available for export.
A bounded list, an unlimited address span
Use at most 100 nonempty ranges and 65,536 UTF-16 code units of active input. A range may still cover a complete address space. This tool emits prefixes, never an expanded list of individual addresses.
Review replacement before applying it
Example and clear actions show a preview and range count. Apply changes the active input; one undo restores the prior input and output state. Conversion itself does not rewrite your source list.

IP range to CIDR questions

Why does a range need several CIDR blocks?

CIDR blocks must start on a power-of-two boundary and have a power-of-two size. An interval such as 192.0.2.5 through 192.0.2.30 does not satisfy those conditions as a single block, so it needs several exact blocks.

Can the CIDR result be reduced further?

For the same address set, the generated block count is minimal. Further reduction would require adding addresses or dropping part of the input. Batch conversion first merges ranges so repeated coverage does not inflate the result.

Can IPv6 address ranges be converted?

Yes. Full and compressed IPv6 endpoints are accepted, including very large intervals. Output stays IPv6, even for IPv4-mapped input, and address counts use exact decimal strings.

What happens when the start address exceeds the end?

The conversion stops with an error. Endpoints are never automatically swapped: correct the range explicitly, then run it again. In a batch, no valid-looking partial output can be exported.

How many CIDR blocks can one range require?

A single inclusive range needs at most 62 IPv4 blocks or 254 IPv6 blocks. Those bounds occur just inside the full address-space edges. The full space itself needs only one /0 block.

Still have a question?

Turn the reviewed set into prefixes

Use IP range to CIDR with your exact endpoints, check the boundary addresses, and download the complete set in the format your next step needs.