Last updated
How CIDR notation works
CIDR notation writes an address, a slash and a prefix length. The prefix is the number of network bits: 10.0.0.0/22 has 22 network bits and 10 host bits, so it holds 2^10 = 1,024 addresses.
A longer prefix leaves fewer host bits and a smaller block. A /24 has 256 addresses and a /30 has 4.
CIDR to IP range
The block size is 2^(32 - prefix). The start address is the address with its host bits set to 0, and the end address is the start plus the size minus 1. 10.0.0.0/22 has 1,024 addresses, so it runs from 10.0.0.0 to 10.0.3.255. 172.16.0.0/12 has 1,048,576 addresses and runs from 172.16.0.0 to 172.31.255.255.
Mask to CIDR
Count the one bits in the mask: 255.255.255.0 is /24, 255.255.240.0 is /20, 255.255.255.252 is /30 and 255.255.255.255 is /32. Type a mask on its own in the box above and the page shows its prefix. A bare 255.255.255.255 is read as a mask, never as an address.
The subnet mask cheat sheet lists all 33 masks in one table.
Common CIDR blocks
Five blocks you will meet often, worked out by the same code as the calculator above.
| Block | Start | End | Addresses | Mask |
|---|---|---|---|---|
| 10.0.0.0/22 | 10.0.0.0 | 10.0.3.255 | 1,024 | 255.255.252.0 |
| 172.16.0.0/12 | 172.16.0.0 | 172.31.255.255 | 1,048,576 | 255.240.0.0 |
| 192.168.0.0/16 | 192.168.0.0 | 192.168.255.255 | 65,536 | 255.255.0.0 |
| 203.0.113.64/26 | 203.0.113.64 | 203.0.113.127 | 64 | 255.255.255.192 |
| 100.64.0.0/10 | 100.64.0.0 | 100.127.255.255 | 4,194,304 | 255.192.0.0 |
Frequently asked questions
What does CIDR notation mean?
CIDR notation writes an address and a prefix length separated by a slash. The prefix says how many leading bits are the network part. In 10.0.0.0/22, 22 bits name the network and the other 10 bits number the hosts, so the block holds 2^10 = 1,024 addresses. A longer prefix means a smaller block.
How do I convert CIDR to an IP range?
Find the block size, 2^(32 - prefix), then count from the network address. For 10.0.0.0/22 the size is 1,024, so the range is 10.0.0.0 to 10.0.3.255. For 203.0.113.64/26 the size is 64, so it runs from 203.0.113.64 to 203.0.113.127. The calculator does this for any block.
How many IP addresses are in a CIDR block?
The count is 2 raised to the power of 32 minus the prefix. A /16 such as 192.168.0.0/16 has 65,536 addresses. A /12 such as 172.16.0.0/12 has 1,048,576 and runs from 172.16.0.0 to 172.31.255.255. A /10 such as 100.64.0.0/10 has 4,194,304.
What if my CIDR block has host bits set?
The calculator still gives an answer. It clears the host bits and tells you the real network. For 10.0.1.5/22 it says you entered a host address and the network is 10.0.0.0/22, which runs from 10.0.0.0 to 10.0.3.255. Use the corrected network when you copy the block somewhere else.
What is 255.255.240.0 in CIDR?
255.255.240.0 is /20, because it has 20 one bits. Type the mask on its own and the calculator shows the prefix. Other common conversions are 255.255.255.0 to /24, 255.255.255.252 to /30 and 255.255.255.255 to /32. The subnet cheat sheet lists all 33 masks in one table.
What is the difference between a CIDR calculator and a subnet calculator?
A CIDR calculator is about the block: its start, end and size. A subnet calculator adds what you need to configure hosts: the broadcast address, wildcard mask, first and last usable host and the binary view. For 192.168.0.0/16 this page gives the range and 65,536 addresses, and the subnet calculator gives the rest.