IPv4 Range ↔ CIDR

CIDR → Range

Start: 192.168.1.0

End: 192.168.1.255

Range → Minimal CIDRs

CIDRs:

  • 10.0.0.5/32
  • 10.0.0.6/31
  • 10.0.0.8/29
  • 10.0.0.16/30
  • 10.0.0.20/32

About This Tool

The IPv4 Range to CIDR converter is a bidirectional tool that converts between IP address ranges and CIDR notation. It can convert a CIDR block (like 192.168.1.0/24) into its start and end IP addresses, or take an arbitrary IP range and calculate the minimal set of CIDR blocks needed to represent it. This is particularly useful when working with systems that use different IP address representation formats or when optimizing network configurations.

How to Use

  1. For CIDR to Range: Enter a CIDR block (e.g., 192.168.1.0/24) in the left panel to see the first and last IP addresses
  2. For Range to CIDR: Enter a start IP and end IP (e.g., 10.0.0.5 to 10.0.0.20) in the right panel
  3. The tool automatically calculates the minimal set of CIDR blocks that exactly cover the range
  4. Results update in real-time as you type
  5. Copy the results for use in firewall rules, routing configurations, or documentation

Features

  • Bidirectional conversion: CIDR to range AND range to CIDR
  • Calculates minimal CIDR representation for any IP range
  • Real-time conversion as you type
  • Handles arbitrary (non-aligned) IP ranges
  • Produces optimized CIDR blocks for efficient routing
  • Validates all IP addresses and CIDR notation
  • Side-by-side interface for easy comparison

Common Use Cases

  • Converting IP ranges from cloud provider consoles to CIDR notation
  • Translating firewall rules from IP range format to CIDR blocks
  • Determining CIDR blocks needed to represent specific IP ranges
  • Converting DHCP scope ranges to CIDR notation for documentation
  • Planning IP address allocations in cloud environments (AWS, Azure, GCP)
  • Optimizing security group rules with minimal CIDR blocks
  • Converting between formats required by different networking tools
  • Verifying IP range coverage for network planning

Technical Details

The conversion between IP ranges and CIDR notation involves understanding how binary addresses align with network boundaries.

CIDR to Range (Simple):

  • CIDR 192.168.1.0/24 represents 256 addresses from 192.168.1.0 to 192.168.1.255
  • CIDR 10.0.0.0/8 represents 16,777,216 addresses from 10.0.0.0 to 10.255.255.255

Range to CIDR (Complex):

When an IP range doesn't align with CIDR boundaries, multiple blocks may be needed. For example, the range 10.0.0.5 to 10.0.0.20 requires multiple CIDRs:

  • 10.0.0.5/32 (single address: 10.0.0.5)
  • 10.0.0.6/31 (2 addresses: 10.0.0.6-7)
  • 10.0.0.8/29 (8 addresses: 10.0.0.8-15)
  • 10.0.0.16/30 (4 addresses: 10.0.0.16-19)
  • 10.0.0.20/32 (single address: 10.0.0.20)

Algorithm: The tool uses a greedy algorithm to find the largest CIDR block that fits within the range, starting from the beginning address, then recursively processes the remaining range until complete coverage is achieved.

This produces the minimal number of CIDR blocks, which is optimal for routing table efficiency and firewall rule performance.