/12 subnet
A /12 has a subnet mask of 255.240.0.0 and 1,048,574 usable hosts.
The numbers
| Prefix length | /12 |
| Subnet mask | 255.240.0.0 |
| Wildcard mask | 0.15.255.255 |
| Network bits | 12 |
| Host bits | 20 |
| Total addresses | 1,048,576 |
| Usable hosts | 1,048,574 |
| /24 networks contained | 4,096 |
Where a /12 is used
The size of the middle private range, 172.16.0.0/12 — which covers 172.16 through 172.31 and stops there. Docker allocates its default bridge networks from inside it.
Why the usable count is what it is
A /12 leaves 20 bits for hosts, giving 220 = 1,048,576 addresses. Two of those cannot be assigned to a machine: the one with all host bits set to zero is the network address, which names the subnet itself, and the one with all host bits set to one is the broadcast address. That leaves 1,048,574.
Binary layout
mask 11111111.11110000.00000000.00000000
^^^^^^^^^^^^
12 network bits, 20 host bits
Splitting and combining
| Prefix | Usable hosts | Relationship | |
|---|---|---|---|
| Twice the size | /11 | 2,097,150 | Two /12 networks combine into one /11 |
| This network | /12 | 1,048,574 | — |
| Half the size | /13 | 524,286 | One /12 splits into two /13 networks |
| A quarter | /14 | 262,142 | Four /14 networks fit in a /12 |
Frequently asked questions
How many hosts are in a /12?
1,048,576 addresses in total, of which 1,048,574 are usable. The first is the network address and the last is the broadcast address, so two are always lost.
What is the subnet mask for /12?
255.240.0.0. The prefix length is the count of leading 1 bits in the mask, so /12 is 12 ones followed by 20 zeros.
What is the wildcard mask for /12?
0.15.255.255 — the bitwise inverse of the subnet mask. Cisco access lists and OSPF network statements take the wildcard rather than the mask; a zero bit must match and a one bit is ignored.
How does a /12 compare to a /24?
A /12 is 4,096 times larger than a /24 — it contains 4,096 of them.