Netmask/Genmask Conversion Table
4,240 Total views across this article’s versions; includes the historical baseline where available.
This chart converts IPv4 prefix lengths to dotted decimal, hexadecimal, inverse, and binary masks. It also separates the number of addresses in a prefix from the number commonly assigned to hosts.
Static Chart
An IPv4 prefix of length p contains 2^(32-p) addresses. The inverse mask is the bitwise complement of the netmask.
For a conventional subnet with distinct network and broadcast addresses, the familiar host-count calculation subtracts two. That calculation is not universal: RFC 3021 permits both addresses of a /31 on a point-to-point link. A /32 identifies one address, commonly used for a host route.
The counts below are arithmetic, not a statement that every address is globally usable or assignable. Special-purpose ranges and the actual link configuration still matter. CIDR does not require class A, B, or C allocations; the old classful block-size comparisons have been replaced by total address counts.
| Prefix | Dotted decimal mask | Hexadecimal mask | Inverse mask | Binary mask | Total addresses | Host-count convention |
|---|---|---|---|---|---|---|
| /0 | 0.0.0.0 | 00 00 00 00 | 255.255.255.255 | 0000 0000 0000 0000 0000 0000 0000 0000 | 4,294,967,296 | 4,294,967,294* |
| /1 | 128.0.0.0 | 80 00 00 00 | 127.255.255.255 | 1000 0000 0000 0000 0000 0000 0000 0000 | 2,147,483,648 | 2,147,483,646* |
| /2 | 192.0.0.0 | C0 00 00 00 | 63.255.255.255 | 1100 0000 0000 0000 0000 0000 0000 0000 | 1,073,741,824 | 1,073,741,822* |
| /3 | 224.0.0.0 | E0 00 00 00 | 31.255.255.255 | 1110 0000 0000 0000 0000 0000 0000 0000 | 536,870,912 | 536,870,910* |
| /4 | 240.0.0.0 | F0 00 00 00 | 15.255.255.255 | 1111 0000 0000 0000 0000 0000 0000 0000 | 268,435,456 | 268,435,454* |
| /5 | 248.0.0.0 | F8 00 00 00 | 7.255.255.255 | 1111 1000 0000 0000 0000 0000 0000 0000 | 134,217,728 | 134,217,726* |
| /6 | 252.0.0.0 | FC 00 00 00 | 3.255.255.255 | 1111 1100 0000 0000 0000 0000 0000 0000 | 67,108,864 | 67,108,862* |
| /7 | 254.0.0.0 | FE 00 00 00 | 1.255.255.255 | 1111 1110 0000 0000 0000 0000 0000 0000 | 33,554,432 | 33,554,430* |
| /8 | 255.0.0.0 | FF 00 00 00 | 0.255.255.255 | 1111 1111 0000 0000 0000 0000 0000 0000 | 16,777,216 | 16,777,214* |
| /9 | 255.128.0.0 | FF 80 00 00 | 0.127.255.255 | 1111 1111 1000 0000 0000 0000 0000 0000 | 8,388,608 | 8,388,606* |
| /10 | 255.192.0.0 | FF C0 00 00 | 0.63.255.255 | 1111 1111 1100 0000 0000 0000 0000 0000 | 4,194,304 | 4,194,302* |
| /11 | 255.224.0.0 | FF E0 00 00 | 0.31.255.255 | 1111 1111 1110 0000 0000 0000 0000 0000 | 2,097,152 | 2,097,150* |
| /12 | 255.240.0.0 | FF F0 00 00 | 0.15.255.255 | 1111 1111 1111 0000 0000 0000 0000 0000 | 1,048,576 | 1,048,574* |
| /13 | 255.248.0.0 | FF F8 00 00 | 0.7.255.255 | 1111 1111 1111 1000 0000 0000 0000 0000 | 524,288 | 524,286* |
| /14 | 255.252.0.0 | FF FC 00 00 | 0.3.255.255 | 1111 1111 1111 1100 0000 0000 0000 0000 | 262,144 | 262,142* |
| /15 | 255.254.0.0 | FF FE 00 00 | 0.1.255.255 | 1111 1111 1111 1110 0000 0000 0000 0000 | 131,072 | 131,070* |
| /16 | 255.255.0.0 | FF FF 00 00 | 0.0.255.255 | 1111 1111 1111 1111 0000 0000 0000 0000 | 65,536 | 65,534* |
| /17 | 255.255.128.0 | FF FF 80 00 | 0.0.127.255 | 1111 1111 1111 1111 1000 0000 0000 0000 | 32,768 | 32,766* |
| /18 | 255.255.192.0 | FF FF C0 00 | 0.0.63.255 | 1111 1111 1111 1111 1100 0000 0000 0000 | 16,384 | 16,382* |
| /19 | 255.255.224.0 | FF FF E0 00 | 0.0.31.255 | 1111 1111 1111 1111 1110 0000 0000 0000 | 8,192 | 8,190* |
| /20 | 255.255.240.0 | FF FF F0 00 | 0.0.15.255 | 1111 1111 1111 1111 1111 0000 0000 0000 | 4,096 | 4,094* |
| /21 | 255.255.248.0 | FF FF F8 00 | 0.0.7.255 | 1111 1111 1111 1111 1111 1000 0000 0000 | 2,048 | 2,046* |
| /22 | 255.255.252.0 | FF FF FC 00 | 0.0.3.255 | 1111 1111 1111 1111 1111 1100 0000 0000 | 1,024 | 1,022* |
| /23 | 255.255.254.0 | FF FF FE 00 | 0.0.1.255 | 1111 1111 1111 1111 1111 1110 0000 0000 | 512 | 510* |
| /24 | 255.255.255.0 | FF FF FF 00 | 0.0.0.255 | 1111 1111 1111 1111 1111 1111 0000 0000 | 256 | 254* |
| /25 | 255.255.255.128 | FF FF FF 80 | 0.0.0.127 | 1111 1111 1111 1111 1111 1111 1000 0000 | 128 | 126* |
| /26 | 255.255.255.192 | FF FF FF C0 | 0.0.0.63 | 1111 1111 1111 1111 1111 1111 1100 0000 | 64 | 62* |
| /27 | 255.255.255.224 | FF FF FF E0 | 0.0.0.31 | 1111 1111 1111 1111 1111 1111 1110 0000 | 32 | 30* |
| /28 | 255.255.255.240 | FF FF FF F0 | 0.0.0.15 | 1111 1111 1111 1111 1111 1111 1111 0000 | 16 | 14* |
| /29 | 255.255.255.248 | FF FF FF F8 | 0.0.0.7 | 1111 1111 1111 1111 1111 1111 1111 1000 | 8 | 6* |
| /30 | 255.255.255.252 | FF FF FF FC | 0.0.0.3 | 1111 1111 1111 1111 1111 1111 1111 1100 | 4 | 2* |
| /31 | 255.255.255.254 | FF FF FF FE | 0.0.0.1 | 1111 1111 1111 1111 1111 1111 1111 1110 | 2 | 2 on RFC 3021 point-to-point links |
| /32 | 255.255.255.255 | FF FF FF FF | 0.0.0.0 | 1111 1111 1111 1111 1111 1111 1111 1111 | 1 | 1 address (host route) |
* For /0 through /30, the final column shows total − 2 only as the conventional subnet calculation. In particular, /0 is the default-route prefix covering the entire IPv4 address space, not a claim that those addresses form one ordinary assignable LAN.
Links to Interactive Tools
- A chart with Cisco masks
- Interactive CIDR calculator
- IPv4 and IPv6 tools for decimal conversion, CIDR, ping, and traceroute