SaveMyCert
IPv4 reference

Subnet mask cheat sheet

Every IPv4 prefix from /8 to /32 with its dotted subnet mask, wildcard mask, block size, total addresses and usable hosts. A /24 is 255.255.255.0 with 254 usable hosts; each extra bit of prefix halves the subnet.

Every prefix from /8 to /32

Usable hosts are the total minus the network and broadcast addresses. The AWS column subtracts the five addresses AWS reserves in every VPC subnet, for the sizes AWS allows.

Subnet masks, wildcards and host counts by CIDR prefix
CIDRSubnet maskWildcardBlock sizeAddressesUsable hostsUsable in AWS
/8255.0.0.00.255.255.25525616,777,21616,777,214—
/9255.128.0.00.127.255.2551288,388,6088,388,606—
/10255.192.0.00.63.255.255644,194,3044,194,302—
/11255.224.0.00.31.255.255322,097,1522,097,150—
/12255.240.0.00.15.255.255161,048,5761,048,574—
/13255.248.0.00.7.255.2558524,288524,286—
/14255.252.0.00.3.255.2554262,144262,142—
/15255.254.0.00.1.255.2552131,072131,070—
/16255.255.0.00.0.255.25525665,53665,53465,531
/17255.255.128.00.0.127.25512832,76832,76632,763
/18255.255.192.00.0.63.2556416,38416,38216,379
/19255.255.224.00.0.31.255328,1928,1908,187
/20255.255.240.00.0.15.255164,0964,0944,091
/21255.255.248.00.0.7.25582,0482,0462,043
/22255.255.252.00.0.3.25541,0241,0221,019
/23255.255.254.00.0.1.2552512510507
/24255.255.255.00.0.0.255256256254251
/25255.255.255.1280.0.0.127128128126123
/26255.255.255.1920.0.0.6364646259
/27255.255.255.2240.0.0.3132323027
/28255.255.255.2400.0.0.1516161411
/29255.255.255.2480.0.0.7886—
/30255.255.255.2520.0.0.3442—
/31255.255.255.2540.0.0.1222—
/32255.255.255.2550.0.0.0111—

Mask values and block sizes

Where a mask stops being 255, the next octet is either 0 or one of seven values. Learn the seven and the block size of any prefix follows: it is 256 minus the mask value.

Mask octet values, the bits they set and the block size
Mask octetBinaryPrefixesBlock size
12810000000/9, /17, /25128
19211000000/10, /18, /2664
22411100000/11, /19, /2732
24011110000/12, /20, /2816
24811111000/13, /21, /298
25211111100/14, /22, /304
25411111110/15, /23, /312

Put it to work

Subnet masks: your questions

A wildcard mask is the inverse of the subnet mask: every 1 becomes 0 and every 0 becomes 1, so /24 (255.255.255.0) has the wildcard 0.0.0.255. Cisco IOS uses wildcard masks in access control lists and OSPF network statements, where a 0 bit means “must match” and a 1 bit means “ignore”.