Reference
CIDR cheat sheet
Every IPv4 prefix length with its subnet mask, wildcard mask and host count. Computed, not typed, so it is right.
| Prefix | Subnet maskWildcard | Wildcard | Addresses | Usable hostsAddresses |
|---|---|---|---|---|
| /0 | 0.0.0.0255.255.255.255 | 255.255.255.255 | 4,294,967,296 | 4,294,967,2944,294,967,296 |
| /1 | 128.0.0.0127.255.255.255 | 127.255.255.255 | 2,147,483,648 | 2,147,483,6462,147,483,648 |
| /2 | 192.0.0.063.255.255.255 | 63.255.255.255 | 1,073,741,824 | 1,073,741,8221,073,741,824 |
| /3 | 224.0.0.031.255.255.255 | 31.255.255.255 | 536,870,912 | 536,870,910536,870,912 |
| /4 | 240.0.0.015.255.255.255 | 15.255.255.255 | 268,435,456 | 268,435,454268,435,456 |
| /5 | 248.0.0.07.255.255.255 | 7.255.255.255 | 134,217,728 | 134,217,726134,217,728 |
| /6 | 252.0.0.03.255.255.255 | 3.255.255.255 | 67,108,864 | 67,108,86267,108,864 |
| /7 | 254.0.0.01.255.255.255 | 1.255.255.255 | 33,554,432 | 33,554,43033,554,432 |
| /8 | 255.0.0.00.255.255.255 | 0.255.255.255 | 16,777,216 | 16,777,21416,777,216 |
| /9 | 255.128.0.00.127.255.255 | 0.127.255.255 | 8,388,608 | 8,388,6068,388,608 |
| /10 | 255.192.0.00.63.255.255 | 0.63.255.255 | 4,194,304 | 4,194,3024,194,304 |
| /11 | 255.224.0.00.31.255.255 | 0.31.255.255 | 2,097,152 | 2,097,1502,097,152 |
| /12 | 255.240.0.00.15.255.255 | 0.15.255.255 | 1,048,576 | 1,048,5741,048,576 |
| /13 | 255.248.0.00.7.255.255 | 0.7.255.255 | 524,288 | 524,286524,288 |
| /14 | 255.252.0.00.3.255.255 | 0.3.255.255 | 262,144 | 262,142262,144 |
| /15 | 255.254.0.00.1.255.255 | 0.1.255.255 | 131,072 | 131,070131,072 |
| /16 | 255.255.0.00.0.255.255 | 0.0.255.255 | 65,536 | 65,53465,536 |
| /17 | 255.255.128.00.0.127.255 | 0.0.127.255 | 32,768 | 32,76632,768 |
| /18 | 255.255.192.00.0.63.255 | 0.0.63.255 | 16,384 | 16,38216,384 |
| /19 | 255.255.224.00.0.31.255 | 0.0.31.255 | 8,192 | 8,1908,192 |
| /20 | 255.255.240.00.0.15.255 | 0.0.15.255 | 4,096 | 4,0944,096 |
| /21 | 255.255.248.00.0.7.255 | 0.0.7.255 | 2,048 | 2,0462,048 |
| /22 | 255.255.252.00.0.3.255 | 0.0.3.255 | 1,024 | 1,0221,024 |
| /23 | 255.255.254.00.0.1.255 | 0.0.1.255 | 512 | 510512 |
| /24 | 255.255.255.00.0.0.255 | 0.0.0.255 | 256 | 254256 |
| /25 | 255.255.255.1280.0.0.127 | 0.0.0.127 | 128 | 126128 |
| /26 | 255.255.255.1920.0.0.63 | 0.0.0.63 | 64 | 6264 |
| /27 | 255.255.255.2240.0.0.31 | 0.0.0.31 | 32 | 3032 |
| /28 | 255.255.255.2400.0.0.15 | 0.0.0.15 | 16 | 1416 |
| /29 | 255.255.255.2480.0.0.7 | 0.0.0.7 | 8 | 68 |
| /30 | 255.255.255.2520.0.0.3 | 0.0.0.3 | 4 | 24 |
| /31 | 255.255.255.2540.0.0.1 | 0.0.0.1 | 2 | 22 |
| /32 | 255.255.255.2550.0.0.0 | 0.0.0.0 | 1 | 11 |
Reading the table
- Highlighted rows fall on octet boundaries: /8, /16 and /24 are the easy ones to remember.
- Each extra prefix bit halves the number of addresses. Each bit removed doubles it.
- Usable hosts is the total minus two, for the network and broadcast addresses. The exceptions are /31, where both addresses work on a point-to-point link (RFC 3021), and /32, which is a single host.
- The wildcard mask is the subnet mask inverted. Access lists use it.
Private address ranges
10.0.0.0/8: 10.0.0.0 to 10.255.255.255172.16.0.0/12: 172.16.0.0 to 172.31.255.255192.168.0.0/16: 192.168.0.0 to 192.168.255.255
These are set aside by RFC 1918. Need the numbers for a specific address? Use the subnet calculator.
Common questions
What does the number after the slash mean?
It is the prefix length: how many of the address's 32 bits identify the network. The remaining bits number the hosts. A /24 has 24 network bits and 8 host bits.
How do I convert a prefix length to a subnet mask?
Write that many 1 bits from the left, fill the rest with 0, and read each group of eight bits as a number. /26 is 26 ones and 6 zeros, which is 255.255.255.192.
How many hosts are in a /24?
A /24 has 256 addresses. Two are reserved for the network and broadcast addresses, which leaves 254 usable hosts.
Which ranges are private?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. They are not routed on the public internet.