curly{bits}

curlybits / Subnet Calculator / CIDR Calculator

CIDR Calculator

Enter a CIDR block like 10.0.0.0/22 to see the IP range it covers, its size and its masks. Or enter a first and last IP address to get the CIDR blocks that cover exactly that range, ready for firewall rules and cloud security groups.

Split into subnets

IP range to CIDR

How to use the CIDR Calculator

  1. Type a CIDR block, such as 172.16.0.0/20, in the first box.
  2. Read the first and last address, the number of addresses and the masks in the results.
  3. To go the other way, scroll to IP range to CIDR and enter the first and last IP of your range.
  4. Copy the list of CIDR blocks for your firewall, AWS or Azure rules.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) writes a block of addresses as a starting address and a prefix length: 10.0.0.0/22 means "the 1,024 addresses that share the first 22 bits with 10.0.0.0", from 10.0.0.0 to 10.0.3.255. It replaced the old class A, B and C networks in 1993, so networks can be any power-of-two size.

Why a range can need several blocks

A CIDR block always holds a power of two (1, 2, 4, 8, 16…) addresses and must start on a matching boundary. A range like 10.0.0.5 to 10.0.0.20 doesn't fit one block, so it becomes several: 10.0.0.5/32, 10.0.0.6/31, 10.0.0.8/29, 10.0.0.16/30 and 10.0.0.20/32. The calculator always finds the shortest list.

Frequently asked questions

How many IP addresses are in a /22?

1,024 (2 to the power of 32 − 22). Usable hosts: 1,022.

What does /32 mean?

A single IP address. In IPv6, a single address is /128.

What does 0.0.0.0/0 mean?

Every IPv4 address. In firewall rules it means "anywhere"; the IPv6 equivalent is ::/0.

Updated