Subnet mask cheat sheet
Every IPv4 prefix length with its subnet mask, wildcard mask and size, the IPv6 prefix sizes in everyday use, and a calculator for any address and prefix. Print it, or keep the page open.
Subnet calculator
IPv4 subnet masks
Usable hosts excludes the network and broadcast addresses, except on a /31, where both addresses are usable on a point-to-point link, and a /32, which is one host.
| Prefix | Subnet mask | Wildcard mask | Addresses | Usable hosts | Hex | Note |
|---|---|---|---|---|---|---|
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | 0xFFFFFFFF | Single host |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | 0xFFFFFFFE | Point-to-point link (RFC 3021) |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | 0xFFFFFFFC | Point-to-point link, traditional |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | 0xFFFFFFF8 | |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | 0xFFFFFFF0 | |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | 0xFFFFFFE0 | |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | 0xFFFFFFC0 | |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | 0xFFFFFF80 | |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | 0xFFFFFF00 | Former class C |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | 0xFFFFFE00 | |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | 0xFFFFFC00 | |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | 0xFFFFF800 | |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | 0xFFFFF000 | |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | 0xFFFFE000 | |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | 0xFFFFC000 | |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | 0xFFFF8000 | |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | 0xFFFF0000 | Former class B |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | 0xFFFE0000 | |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | 0xFFFC0000 | |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | 0xFFF80000 | |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | 0xFFF00000 | |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | 0xFFE00000 | |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | 0xFFC00000 | |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | 0xFF800000 | |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | 0xFF000000 | Former class A |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | 0xFE000000 | |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | 0xFC000000 | |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | 0xF8000000 | |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | 0xF0000000 | |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | 0xE0000000 | |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | 0xC0000000 | |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | 0x80000000 | |
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | 0x00000000 | Default route |
IPv6 prefix sizes
IPv6 is planned in /64 subnets rather than host counts: every LAN is a /64, and sites are given a block of them.
| Prefix | /64 subnets | Contains | Typical use |
|---|---|---|---|
| /128 | – | A single address: a loopback or a host route | |
| /127 | – | Point-to-point link between two routers (RFC 6164) | |
| /64 | 1 | One subnet: the standard size for a LAN, required for SLAAC | |
| /60 | 16 | A small site | |
| /56 | 256 | A typical end-site assignment, e.g. a home or small office | |
| /52 | 4,096 | 16 × /56 | A larger site |
| /48 | 65,536 | 256 × /56 | A typical business site assignment |
| /44 | 1,048,576 | 16 × /48 | A group of sites |
| /40 | 16,777,216 | 256 × /48 | A regional or campus block |
| /32 | 4,294,967,296 | 65,536 × /48 | A large network or ISP block |
| /29 | 34,359,738,368 | 524,288 × /48 | The usual initial allocation to a RIPE NCC member |
Special-purpose ranges
| Range | Purpose | Defined in |
|---|---|---|
| 10.0.0.0/8 | Private network | RFC 1918 |
| 172.16.0.0/12 | Private network | RFC 1918 |
| 192.168.0.0/16 | Private network | RFC 1918 |
| 100.64.0.0/10 | Shared address space for carrier-grade NAT | RFC 6598 |
| 127.0.0.0/8 | Loopback | RFC 1122 |
| 169.254.0.0/16 | Link-local | RFC 3927 |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation and examples | RFC 5737 |
| 224.0.0.0/4 | Multicast | RFC 5771 |
| fc00::/7 | IPv6 unique local addresses | RFC 4193 |
| fe80::/10 | IPv6 link-local | RFC 4291 |
| 2001:db8::/32 | IPv6 documentation | RFC 3849 |