StringMash.com

CIDR calculator

CIDR blocks to IP ranges and back, with the binary shown.

21 characters
Updates as you type
The binary working is below

Show the steps
  1. The range holds 1,024 addresses.
  2. It lines up exactly with one CIDR block.

Using the calculator

Type a block in CIDR notation, like 10.0.0.0/22, to see the range it covers, its mask and how many hosts it holds. Or type a range, like 10.0.0.0 - 10.0.3.255, and the calculator gives the fewest CIDR blocks that cover exactly that range and nothing more.

A range that doesn't line up with block boundaries needs several blocks. 10.0.0.1 to 10.0.0.6 takes four: 10.0.0.1/32, 10.0.0.2/31, 10.0.0.4/31 and 10.0.0.6/32.

What CIDR notation means

The number after the slash is the prefix length: how many leading bits are fixed. 10.0.0.0/22 fixes the first 22 bits and leaves 10 free, so it covers 2¹⁰ = 1,024 addresses, from 10.0.0.0 to 10.0.3.255. A block always starts on a multiple of its own size, which is why some ranges need more than one.

Why it replaced address classes

Before CIDR, networks came in fixed classes, A, B and C, with 8, 16 or 24 network bits. RFC 4632, which in August 2006 replaced the original CIDR document, RFC 1519 from September 1993, names the problems that caused: the Class B space was running out, routing tables were growing beyond what routers and people could manage, and the 32-bit address space itself would eventually run out.

CIDR let networks be any size and let routers combine neighbouring blocks into one route, which slowed both problems down.

Questions

What does /16 mean?

The first 16 bits are the network, leaving 16 for hosts: 65,536 addresses, the size of an old Class B network.

Why can't any range be one block?

A CIDR block's size is a power of two, and it has to start on a multiple of that size. A range that starts or ends in between needs smaller blocks to fill the gaps.