IP Range to CIDR Converter

Convert an IPv4 address range into the smallest possible set of CIDR blocks.

What does IP range to CIDR mean?

An IP range is written as a start and end address, like 192.168.1.0 – 192.168.1.255. CIDR notation describes the same block with a network address and a prefix length, like 192.168.1.0/24. Converting a range to CIDR means expressing it as the smallest possible set of CIDR blocks that covers exactly the same addresses.

Why convert ranges to CIDR?

  • Firewall allowlists: many firewalls and web application firewalls accept CIDR blocks but not arbitrary ranges, so you need to translate vendor IP lists.
  • Cloud networks: AWS security groups, Azure NSGs, and GCP firewall rules are configured with CIDR blocks.
  • Routing tables: static routes and BGP announcements are expressed as prefixes, not ranges.
  • Access control rules: ACLs and VPN policies match traffic by CIDR.

Example

The range 192.168.1.0 – 192.168.1.255 converts to the single block 192.168.1.0/24. But the range 192.168.1.1 – 192.168.1.6 requires four blocks: 192.168.1.1/32, 192.168.1.2/31, 192.168.1.4/31, and 192.168.1.6/32.

Why can one range require multiple CIDRs?

A CIDR block must have a power-of-two size (2, 4, 8, 16… addresses) and its network address must align to that size. A range that starts at .1 or spans 6 addresses cannot be a single aligned power-of-two block, so it is split into the fewest blocks that stay within the original range — never covering an address outside it.

Related Tools