Skip to the content

Subnet Mask Cheat Sheet

Every IPv4 prefix length from /0 to /32 with its subnet mask, wildcard mask, number of addresses and usable hosts.

Every IPv4 prefix length with its subnet mask, wildcard mask and size
PrefixSubnet maskUsable hosts
/00.0.0.04,294,967,294
Wildcard 255.255.255.255 · 4,294,967,296 addresses
/1128.0.0.02,147,483,646
Wildcard 127.255.255.255 · 2,147,483,648 addresses
/2192.0.0.01,073,741,822
Wildcard 63.255.255.255 · 1,073,741,824 addresses
/3224.0.0.0536,870,910
Wildcard 31.255.255.255 · 536,870,912 addresses
/4240.0.0.0268,435,454
Wildcard 15.255.255.255 · 268,435,456 addresses
/5248.0.0.0134,217,726
Wildcard 7.255.255.255 · 134,217,728 addresses
/6252.0.0.067,108,862
Wildcard 3.255.255.255 · 67,108,864 addresses
/7254.0.0.033,554,430
Wildcard 1.255.255.255 · 33,554,432 addresses
/8255.0.0.016,777,214
Wildcard 0.255.255.255 · 16,777,216 addresses
/9255.128.0.08,388,606
Wildcard 0.127.255.255 · 8,388,608 addresses
/10255.192.0.04,194,302
Wildcard 0.63.255.255 · 4,194,304 addresses
/11255.224.0.02,097,150
Wildcard 0.31.255.255 · 2,097,152 addresses
/12255.240.0.01,048,574
Wildcard 0.15.255.255 · 1,048,576 addresses
/13255.248.0.0524,286
Wildcard 0.7.255.255 · 524,288 addresses
/14255.252.0.0262,142
Wildcard 0.3.255.255 · 262,144 addresses
/15255.254.0.0131,070
Wildcard 0.1.255.255 · 131,072 addresses
/16255.255.0.065,534
Wildcard 0.0.255.255 · 65,536 addresses
/17255.255.128.032,766
Wildcard 0.0.127.255 · 32,768 addresses
/18255.255.192.016,382
Wildcard 0.0.63.255 · 16,384 addresses
/19255.255.224.08,190
Wildcard 0.0.31.255 · 8,192 addresses
/20255.255.240.04,094
Wildcard 0.0.15.255 · 4,096 addresses
/21255.255.248.02,046
Wildcard 0.0.7.255 · 2,048 addresses
/22255.255.252.01,022
Wildcard 0.0.3.255 · 1,024 addresses
/23255.255.254.0510
Wildcard 0.0.1.255 · 512 addresses
/24255.255.255.0254
Wildcard 0.0.0.255 · 256 addresses
/25255.255.255.128126
Wildcard 0.0.0.127 · 128 addresses
/26255.255.255.19262
Wildcard 0.0.0.63 · 64 addresses
/27255.255.255.22430
Wildcard 0.0.0.31 · 32 addresses
/28255.255.255.24014
Wildcard 0.0.0.15 · 16 addresses
/29255.255.255.2486
Wildcard 0.0.0.7 · 8 addresses
/30255.255.255.2522
Wildcard 0.0.0.3 · 4 addresses
/31255.255.255.2542
Wildcard 0.0.0.1 · 2 addresses
/32255.255.255.2551
Wildcard 0.0.0.0 · 1 address
Share this tool:TwitterFacebookLinkedInWhatsAppEmail

Reading the table

Each step down the table moves one bit from the host part of an address to the network part, so the number of addresses halves. Two addresses of a network cannot be given to a device, the network address and the broadcast address, which is why the last column is two lower. The bottom two rows are the exceptions: both addresses of a /31 are usable on a link between two routers, and a /32 is a single host.

The wildcard mask is the subnet mask with every bit flipped. Cisco access lists and OSPF use it.

The eight numbers a mask is made of

A mask is a run of ones followed by zeros, so besides 0 only eight values can occur in it. Which one depends on how many bits of that number belong to the network:

Network bits in that numberNumber in the maskNetworks are this far apart
1128128
219264
322432
424016
52488
62524
72542
82551

The right-hand column is the handy one. With the mask 255.255.255.224, networks are 32 addresses apart and start at .0, .32, .64 and so on. With 255.255.240.0 they are 16 apart in the third number: 10.0.0.0, 10.0.16.0, 10.0.32.0.

Without the table

Two sums replace it. The number of addresses is 2 to the power of (32 − prefix): a /27 has 2⁵ = 32. And 256 minus the one number of the mask that is neither 255 nor 0 gives the distance between networks: for 255.255.255.224 that is 256 − 224 = 32.

Going the other way, count the ones. 255 is eight of them and 224 is three, so 255.255.255.224 is 8 + 8 + 8 + 3 = /27.

For one particular address, the subnet calculator works out the network, the host range and the broadcast address, and splits a network into subnets.