CIDR to IP Range

Convert CIDR notation to IP ranges, and IP ranges back to minimal CIDR lists. IPv4 and IPv6.

Try:
First address
Last address
Total addresses

Try:
Total addresses
CIDR blocks

CIDR notation in a nutshell

CIDR (Classless Inter-Domain Routing) notation describes an IP prefix as an address plus the number of fixed leading bits, e.g. 10.0.0.0/8. The remaining bits are free, so a /24 fixes 24 of an IPv4 address's 32 bits and leaves 28 = 256 addresses. An arbitrary IP range does not always align to a single CIDR block, which is why converting a range can produce several blocks. This converter uses the same primitives that power Ipregistry's IP data API.

How many addresses is a /24, /16, or /8?

An IPv4 prefix of length n spans 232−n addresses: a /32 is a single address, a /24 is 256, a /16 is 65,536, and a /8 is 16,777,216. For IPv6 the same rule uses 128 bits, so a /64, the standard size of a single subnet, already contains 264 addresses. Use the converter above to get the exact first address, last address, and count for any block.

Converting an IP range to CIDR blocks

The reverse direction is trickier: a range like 10.0.0.5–10.0.0.20 starts off-boundary, so no single prefix covers exactly those addresses. The converter computes the minimal list of CIDR blocks that tiles the range, which is what firewall rules, ACLs, and BGP prefix filters expect as input.

Frequently asked questions

How do I calculate the IP range from a CIDR block?

Enter the CIDR block, for example 192.168.0.0/24, in the first field and press Convert. The calculator returns the first address, the last address, and the total number of addresses the block contains.

How do I calculate CIDR blocks from an IP range?

Enter the start and end addresses of the range in the second form. Because an arbitrary range rarely aligns to a single prefix, the calculator returns the minimal list of CIDR blocks that covers exactly the addresses in the range.

Does the calculator support IPv6?

Yes. Both directions accept IPv4 and IPv6 input, for example 2001:db8::/48 as a CIDR block or a start and end pair of IPv6 addresses.

Why does one IP range convert to several CIDR blocks?

A CIDR block always starts on a power-of-two boundary and spans a power-of-two number of addresses. A range like 10.0.0.5 to 10.0.0.20 starts off-boundary, so no single prefix matches it exactly and several blocks are needed to tile it.

Related

Look up who operates a block by opening its subnet page, e.g. 1.1.1.0/24, or explore the IP to Number and IPv6 Expander tools. To resolve CIDR blocks to location, operator, and risk data in bulk, see the IP data overview and downloadable datasets.

Try different tools

Explore all