IP Range to CIDR Converter

Enter a start and end IP address (IPv4 or IPv6) to get the minimal set of CIDR blocks covering the range.

Results

Instructions

  1. Enter a valid start and end IP address (e.g., 192.168.1.0 and 192.168.1.255).
  2. Click "Convert" to see the minimal set of CIDR blocks that cover the range.
  3. Both IPv4 and IPv6 addresses are supported.
  4. If the input is invalid, an error will be shown.

Example: - Input: Start IP: 192.168.1.0, End IP: 192.168.1.255 - Output: 192.168.1.0/24 - Input: Start IP: 192.168.1.0, End IP: 192.168.1.10 - Output: 192.168.1.0/29, 192.168.1.8/31, 192.168.1.10/32

Frequently Asked Questions (FAQs)

What if the start IP is greater than the end IP?

The tool will automatically swap them to ensure a valid range.

Can I use IPv6 addresses?

Yes, both IPv4 and IPv6 are supported.

Why are there sometimes multiple CIDRs?

Some ranges cannot be represented by a single CIDR, so the tool finds the minimal set that covers the range.

What happens if I enter an invalid IP?

The tool will show an error message and no CIDRs will be displayed.

API Usage

POST /tools/ip-range-to-cidr/api/

Request Body: { "start_ip": "192.168.1.0", "end_ip": "192.168.1.10" }

Response: { "cidrs": ["192.168.1.0/29", "192.168.1.8/31", "192.168.1.10/32"] }