CIDR reference · IPv4

The /12 CIDR block

1,048,576 addresses, 1,048,574 usable, subnet mask 255.240.0.0.

/12 · 255.240.0.0 Open in the calculator

172.16.0.0/12 is the second RFC 1918 private range, spanning 172.16.0.0 to 172.31.255.255. Docker's default bridge networks are carved from it, which is why containers often get 172.17.x.x addresses.

Key numbers

Prefix length/12 (12 network bits, 20 host bits)
Subnet mask255.240.0.0
Mask in binary11111111.11110000.00000000.00000000
Wildcard mask0.15.255.255
Total addresses1,048,576
Usable hosts1,048,574 (total minus network and broadcast)
Contains4,096 × /24 networks
Block sizeIncrements of 16 in octet 2

Example ranges

Private (RFC 1918) blocks of this size. Click one to open it in the calculator.

BlockFirst addressLast addressUsable hosts
10.0.0.0/1210.0.0.010.15.255.25510.0.0.1 – 10.15.255.254
172.16.0.0/12172.16.0.0172.31.255.255172.16.0.1 – 172.31.255.254

Usable addresses in the cloud

Cloud providers reserve a few addresses in every subnet for the router, DNS and future use, so the usable count is lower than the formula gives.

ProviderUsable in a /12Notes
AWS VPC subnetn/aNot allowed: AWS subnets must be between /16 and /28.
Azure virtual network subnet1,048,571Allowed. Azure reserves the first four addresses and the last one.
Google Cloud subnet1,048,572Allowed. Google Cloud reserves the first two and the last two addresses.

How the numbers are derived

An IPv4 address has 32 bits. A /12 uses 12 of them for the network, leaving 20 host bits, so the block has 220 = 1,048,576 addresses. The first address (all host bits 0) is the network address and the last (all host bits 1) is the broadcast address, which leaves 1,048,574 for hosts. The subnet mask is 12 ones followed by 20 zeros, written in dotted decimal as 255.240.0.0; the wildcard mask 0.15.255.255 is its inverse, used in Cisco ACLs and OSPF configuration.

FAQ

How many hosts can a /12 have?

1,048,576 addresses in total, of which 1,048,574 are usable after removing the network and broadcast addresses. Cloud providers reserve a few more: 1,048,571 usable in AWS and Azure, 1,048,572 in Google Cloud.

How many /24 subnets fit in a /12?

4,096. Each step of the prefix length halves or doubles the block, so a /12 contains 2^(24 − 12) = 4,096 networks of /24 size.