Subnet cheat sheet

Every IPv4 prefix, its masks, its size and its usable hosts. Bookmark it and stop deriving this.

Print or keep it

Download the PDF ↓

One page, US Letter, laid out to be pinned above a desk. It carries the same tables as this page and is generated from the same data, so the two cannot disagree.

Every prefix from /8 to /32

Usable host counts already have the network and broadcast addresses subtracted. The two exceptions are called out in the notes.

CIDRSubnet maskWildcardAddressesUsable
/8255.0.0.00.255.255.25516,777,21616,777,21410.0.0.0/8
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574172.16.0.0/12
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534192.168.0.0/16
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254the default home network
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342classic router link
/31255.255.255.2540.0.0.122no broadcast, RFC 3021
/32255.255.255.2550.0.0.011a single host

The two formulas

addresses  =  2 ^ (32 - prefix)
usable     =  2 ^ (32 - prefix) - 2      except /31 and /32

Going the other way, from a host requirement to a prefix: add two, round up to the next power of two, and that is your block size. See network, broadcast and usable hosts for the worked version.

Powers of two

The only table underneath all of this. Everything else is derived from it.

2^1  = 2        2^7  = 128        2^13 = 8,192
2^2  = 4        2^8  = 256        2^14 = 16,384
2^3  = 8        2^9  = 512        2^15 = 32,768
2^4  = 16       2^10 = 1,024      2^16 = 65,536
2^5  = 32       2^11 = 2,048      2^20 = 1,048,576
2^6  = 64       2^12 = 4,096      2^24 = 16,777,216

Mask octet values

A mask octet can only be one of these nine, because a mask is always ones followed by zeros. The block size column is 256 minus the value, which is the fastest route to a boundary.

DecimalBinaryOnesBlock size
0000000000256
128100000001128
19211000000264
22411100000332
24011110000416
2481111100058
2521111110064
2541111111072
2551111111181

Reserved and special-purpose ranges

RangeNameWhat it means
10.0.0.0/8PrivateRFC 1918. Businesses, data centers, VPNs
172.16.0.0/12PrivateRFC 1918. Common inside containers
192.168.0.0/16PrivateRFC 1918. Home routers
100.64.0.0/10Carrier-grade NATRFC 6598. Shared provider address
127.0.0.0/8LoopbackThis machine. Never leaves it
169.254.0.0/16Link-localSelf-assigned. Usually means DHCP failed
224.0.0.0/4MulticastOne to many delivery
192.0.2.0/24DocumentationRFC 5737. Safe in examples
198.51.100.0/24DocumentationRFC 5737
203.0.113.0/24DocumentationRFC 5737. Used throughout this site
0.0.0.0/0Default routeEvery address. Anywhere in a firewall rule

Common IPv6 prefixes

Host counting stops being useful in IPv6, so the conventions are about structure instead.

PrefixTypically
/48An allocation to a site or organization
/56A common residential allocation
/64One network segment. The standard subnet size
/127A point-to-point link, the IPv6 equivalent of /31
/128A single host

A single /64 holds about 18 quintillion addresses, which is more than the whole IPv4 internet squared. Nobody subnets IPv6 to save addresses.

Where to swim next