breakitdown

What does /20 mean?

Answer

A /20 leaves 12 host bits: 4,096 addresses, 4,094 usable hosts, with netmask 255.255.240.0. It is exactly sixteen /24 networks, for example 172.31.0.0 to 172.31.15.255.

Worked example: 172.31.0.0/20. Type any block to compare.

Try

172.31.0.0/20 is 4,096 addresses: 172.31.0.0 to 172.31.15.255. 4,094 usable for hosts (the first is the network address, the last is broadcast).

172101011003100011111000000000000000000
20 network bits 12 host bits
Network
172.31.0.0
First usable
172.31.0.1
Last usable
172.31.15.254
Broadcast
172.31.15.255
Addresses
4,096
Usable hosts
4,094
Netmask
255.255.240.0
Wildcard (ACL) mask
0.0.15.255
Historic class
B
Range type
Private network · not routed on the internet

Special-purpose range

Private network 172.16.0.0/12 RFC 1918
The middle private IPv4 range: 172.16.0.0 to 172.31.255.255. Docker's default bridge networks are carved from it.

Split it into subnets

or

4 subnets.

SubnetUsable rangeHostsBroadcast
172.31.0.0/22172.31.0.1 – 172.31.3.2541,022172.31.3.255
172.31.4.0/22172.31.4.1 – 172.31.7.2541,022172.31.7.255
172.31.8.0/22172.31.8.1 – 172.31.11.2541,022172.31.11.255
172.31.12.0/22172.31.12.1 – 172.31.15.2541,022172.31.15.255

Is this IP in the range?

Range to CIDR blocks

What to know

/20 is where the boundary falls inside the third octet: 240 in the mask means the third number moves in steps of 16, so /20 networks start at x.x.0.0, x.x.16.0, x.x.32.0 and so on.

AWS default VPCs use /20 subnets (172.31.0.0/20, 172.31.16.0/20, ...), one per availability zone. AWS reserves 5 addresses in every subnet, so a /20 gives 4,091 assignable addresses. Docker also uses /20 blocks from 192.168.0.0/16 for new networks once its 172.x /16 pool is used up.

Gotchas

Related explainers

← CIDR calculator