CIDR Range Calculator

A CIDR prefix such as /24 compresses a whole range of IPv4 addresses into a single network and prefix-length notation. The prefix length is the count of network bits, and everything else is host space. This calculator takes a prefix length from 0 to 32 and returns the total number of addresses in the block, the number of usable hosts, the block size, and the dotted-decimal subnet mask. It is built directly from the RFC 4632 definition of classless addressing, where the address count is 2 raised to the power of the remaining host bits.

0.00
0.00
0.00
0.00

CIDR range formula

Host bits = 32 - prefix length
Total addresses = 2 ^ host bits
Usable hosts = total addresses - 2 (for prefix 0 to 30)
Usable hosts = 2 (for /31, RFC 3021)
Usable hosts = 1 (for /32)
Subnet mask = 32-bit value, prefix-length leading 1 bits

Block size equals total addresses. The two reserved addresses are the network identifier and the broadcast address, which is why a /24 has 256 addresses but 254 usable hosts.

CIDR context

  • CIDR replaced the older fixed Class A, B, and C scheme to allow flexible allocation, defined in RFC 4632.
  • A /24 (255.255.255.0) is the most common LAN subnet, with 254 usable hosts.
  • A /30 gives 4 addresses and 2 usable hosts, historically used for point-to-point links.
  • A /31 (RFC 3021) gives 2 addresses both usable, the modern point-to-point convention.
  • A /32 is a single host route, often used in routing tables and loopback assignments.

CIDR range calculator: frequently asked questions

What does the CIDR prefix length mean?

In CIDR (Classless Inter-Domain Routing, defined in RFC 4632), the prefix length is the number of leading 1 bits in the subnet mask. A /24 has 24 network bits and 8 host bits, so it contains 2 to the power of 8 = 256 addresses. The prefix can range from /0 (the whole IPv4 space) to /32 (a single host).

How many usable hosts are in a CIDR block?

For a standard IPv4 subnet, usable hosts equal the total addresses minus 2: one address is reserved for the network identifier and one for the broadcast address. A /24 has 256 total addresses and 254 usable hosts. The exceptions are /31 (RFC 3021, used for point-to-point links, 2 usable) and /32 (a single host route).

What is the block size of a CIDR prefix?

The block size is the total number of IPv4 addresses the prefix covers, equal to 2 raised to the power of (32 minus prefix length). A /26 covers 2^(32-26) = 2^6 = 64 addresses. Block size determines how subnet boundaries align on the address space.

How is the subnet mask derived from a CIDR prefix?

The subnet mask is a 32-bit value with the prefix-length leading bits set to 1 and the rest set to 0. A /24 gives 11111111.11111111.11111111.00000000, which is 255.255.255.0 in dotted decimal. A /20 gives 255.255.240.0.

Does this calculator handle IPv6?

This calculator covers IPv4 prefixes (/0 to /32). IPv6 uses 128-bit addresses (RFC 4291), so an IPv6 block size is 2 raised to the power of (128 minus prefix length), which produces extremely large numbers. The same host-count logic does not apply because IPv6 does not use broadcast addresses.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 17 June 2026. See our methodology.