IP Range to CIDR

Converter

Convert an IP address range into the minimum list of CIDR blocks that cover it. Runs entirely in your browser.

IP Range
CIDR Blocks
Enter a start and end IP above to convert the range to CIDR blocks

About this tool

About IP Range to CIDR

Firewalls, routers, and cloud security groups almost always express network rules in CIDR notation (like 10.0.0.0/24), but the range you actually need to allow or block is often given as a plain start and end IP address instead. This tool converts an arbitrary IP range into the minimum set of CIDR blocks that together cover exactly that range — no more, no less.

The tool uses the standard greedy algorithm: at each step, it finds the largest CIDR block that can start at the current address without either misaligning with power-of-two boundaries or overshooting the end of the range, emits that block, and advances past it. This repeats until the whole range is covered, always producing the minimum possible number of blocks.

Use this to convert a start/end IP range from a spreadsheet, ticket, or vendor documentation into CIDR blocks for a firewall rule, AWS security group, or router ACL, or to double-check that a set of CIDR blocks correctly covers an intended range.

Instant, fully client-side conversion with no data ever leaving your browser. The greedy algorithm always produces the mathematically minimum number of CIDR blocks for a given range — never more than necessary.

Key Features

  • Converts any valid start/end IPv4 range into CIDR blocks
  • Always produces the minimum number of blocks needed
  • Handles ranges that don't align to a single power-of-two block with multiple blocks
  • Copy all resulting CIDR blocks with one click
  • Clear error messages for invalid or reversed ranges
  • 100% browser-based, no data ever transmitted

FAQ

IP Range to CIDR — Frequently Asked Questions

Why can't every IP range be expressed as a single CIDR block?

A CIDR block always represents a power-of-two-sized range that starts on a boundary aligned to that size (for example, a /24 must start at an address ending in .0). If your range doesn't happen to start and end on such a boundary, it can't be represented by one block — it needs to be split into several blocks of different sizes.

How does the tool decide how many blocks to use?

It uses a greedy algorithm: starting from the beginning of the range, it picks the largest possible CIDR block that both (a) is aligned to start at the current address, and (b) doesn't extend past the end of the range. It emits that block, moves past it, and repeats until the whole range is covered. This approach always produces the mathematically minimum number of blocks.

Can I convert a range that's already a single CIDR block?

Yes — if your start and end IPs happen to align exactly to a power-of-two block (like 192.168.1.0 to 192.168.1.255), the tool will return that single block rather than splitting it unnecessarily.

What happens if my start IP is greater than my end IP?

The tool returns an error. Make sure the 'start' field contains the lower address and the 'end' field contains the higher address in the range.

Does this work for IPv6 ranges too?

No, this tool is IPv4-only. For IPv6 address manipulation, use the separate IPv6 Expander/Compressor tool.

Tips

  • If your range doesn't align to a single CIDR block, expect multiple blocks in the output — that's normal and unavoidable for arbitrary ranges
  • Use the copy button to grab all resulting blocks at once, ready to paste into a firewall rule or security group
  • A single-host range (start equals end) always produces one /32 block
  • This converter never sends your IP range anywhere — everything is computed entirely in your browser

Explore more

Related Tools

Other tools that might be useful for your workflow