ToolSec

CIDR ↔ IP Range Converter

Expand a CIDR to its address range, or collapse an IP range into minimal CIDR blocks.

Updated: June 27, 2026

Convert between CIDR blocks and IP ranges

Firewalls, ACLs and security groups often want a CIDR block, while documentation and ticketing systems describe a plain start–end IP range. This tool converts in both directions: expand a CIDR like 192.168.1.0/24 into its first and last address and total count, or take an arbitrary range and collapse it into the smallest set of CIDR blocks that covers it exactly. Everything runs in your browser.

CIDR → range

A CIDR block is a base address plus a prefix length. The prefix says how many leading bits are fixed; the rest enumerate the addresses. /24 fixes 24 bits and leaves 8 for hosts — 256 addresses, from .0 to .255. The tool computes the aligned network address even if you enter a host address inside the block, so 192.168.1.130/26 correctly yields the 192.168.1.128192.168.1.191 range.

Range → CIDR (the harder direction)

Going from an arbitrary range to CIDR is more interesting, because most ranges don't line up to a single power-of-two block. The minimal cover is found greedily: at each step, take the largest CIDR block that both starts at the current address (is properly aligned) and fits within what's left of the range, then advance. For example 192.168.1.0192.168.1.10 becomes 192.168.1.0/29, 192.168.1.8/31 and 192.168.1.10/32 — three blocks that together cover exactly those 11 addresses and nothing more.

Why exact matters

When you translate a range into firewall rules, an over-broad CIDR silently lets in addresses you didn't intend, while a too-narrow one breaks legitimate traffic. The minimal-cover approach gives you blocks that match the range precisely — no extra addresses, no gaps. Always review the result before applying it to a security policy.

Part of your network toolkit

Use this alongside the IPv4 subnet calculator for full subnet details, and the IPv6 subnet calculator when you move to IPv6 address planning.

Frequently asked questions

How do I convert a CIDR to an IP range?

Enter the CIDR (e.g. 10.0.0.0/24) and the tool returns the first address, last address and total count. It aligns to the network address even if you type a host address inside the block.

Why does my IP range become several CIDR blocks?

Most ranges don't align to a single power-of-two block, so they're covered by the minimal set of CIDRs. Each block is the largest that fits the alignment and remaining range, giving an exact cover with no extra addresses.

Will the CIDR blocks cover exactly my range?

Yes. The minimal-cover algorithm produces blocks that together match the start–end range precisely — no addresses outside the range are included.

How many addresses are in a /24?

256 total addresses. In practice 254 are assignable to hosts after excluding the network and broadcast addresses, but the range itself spans all 256.

Network & firewall management

Translating ranges into rules at scale is easier with the right tools:

  • Firewall / policy management Manage and audit allow-lists as CIDR blocks across many devices from one console.
  • IP address management (IPAM) Track which CIDR ranges are allocated where, preventing overlaps and documentation drift.

Learn more

Related tools