Netmask/Genmask Conversion Table

Topics · Published 2019-08-25 · Revised 2026-11-23
Reviewed corrections applied locally; pre-review version preserved separately · Joomla source

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.

PrefixDotted decimal maskHexadecimal maskInverse maskBinary maskTotal addressesHost-count convention
/00.0.0.000 00 00 00255.255.255.2550000 0000 0000 0000 0000 0000 0000 00004,294,967,2964,294,967,294*
/1128.0.0.080 00 00 00127.255.255.2551000 0000 0000 0000 0000 0000 0000 00002,147,483,6482,147,483,646*
/2192.0.0.0C0 00 00 0063.255.255.2551100 0000 0000 0000 0000 0000 0000 00001,073,741,8241,073,741,822*
/3224.0.0.0E0 00 00 0031.255.255.2551110 0000 0000 0000 0000 0000 0000 0000536,870,912536,870,910*
/4240.0.0.0F0 00 00 0015.255.255.2551111 0000 0000 0000 0000 0000 0000 0000268,435,456268,435,454*
/5248.0.0.0F8 00 00 007.255.255.2551111 1000 0000 0000 0000 0000 0000 0000134,217,728134,217,726*
/6252.0.0.0FC 00 00 003.255.255.2551111 1100 0000 0000 0000 0000 0000 000067,108,86467,108,862*
/7254.0.0.0FE 00 00 001.255.255.2551111 1110 0000 0000 0000 0000 0000 000033,554,43233,554,430*
/8255.0.0.0FF 00 00 000.255.255.2551111 1111 0000 0000 0000 0000 0000 000016,777,21616,777,214*
/9255.128.0.0FF 80 00 000.127.255.2551111 1111 1000 0000 0000 0000 0000 00008,388,6088,388,606*
/10255.192.0.0FF C0 00 000.63.255.2551111 1111 1100 0000 0000 0000 0000 00004,194,3044,194,302*
/11255.224.0.0FF E0 00 000.31.255.2551111 1111 1110 0000 0000 0000 0000 00002,097,1522,097,150*
/12255.240.0.0FF F0 00 000.15.255.2551111 1111 1111 0000 0000 0000 0000 00001,048,5761,048,574*
/13255.248.0.0FF F8 00 000.7.255.2551111 1111 1111 1000 0000 0000 0000 0000524,288524,286*
/14255.252.0.0FF FC 00 000.3.255.2551111 1111 1111 1100 0000 0000 0000 0000262,144262,142*
/15255.254.0.0FF FE 00 000.1.255.2551111 1111 1111 1110 0000 0000 0000 0000131,072131,070*
/16255.255.0.0FF FF 00 000.0.255.2551111 1111 1111 1111 0000 0000 0000 000065,53665,534*
/17255.255.128.0FF FF 80 000.0.127.2551111 1111 1111 1111 1000 0000 0000 000032,76832,766*
/18255.255.192.0FF FF C0 000.0.63.2551111 1111 1111 1111 1100 0000 0000 000016,38416,382*
/19255.255.224.0FF FF E0 000.0.31.2551111 1111 1111 1111 1110 0000 0000 00008,1928,190*
/20255.255.240.0FF FF F0 000.0.15.2551111 1111 1111 1111 1111 0000 0000 00004,0964,094*
/21255.255.248.0FF FF F8 000.0.7.2551111 1111 1111 1111 1111 1000 0000 00002,0482,046*
/22255.255.252.0FF FF FC 000.0.3.2551111 1111 1111 1111 1111 1100 0000 00001,0241,022*
/23255.255.254.0FF FF FE 000.0.1.2551111 1111 1111 1111 1111 1110 0000 0000512510*
/24255.255.255.0FF FF FF 000.0.0.2551111 1111 1111 1111 1111 1111 0000 0000256254*
/25255.255.255.128FF FF FF 800.0.0.1271111 1111 1111 1111 1111 1111 1000 0000128126*
/26255.255.255.192FF FF FF C00.0.0.631111 1111 1111 1111 1111 1111 1100 00006462*
/27255.255.255.224FF FF FF E00.0.0.311111 1111 1111 1111 1111 1111 1110 00003230*
/28255.255.255.240FF FF FF F00.0.0.151111 1111 1111 1111 1111 1111 1111 00001614*
/29255.255.255.248FF FF FF F80.0.0.71111 1111 1111 1111 1111 1111 1111 100086*
/30255.255.255.252FF FF FF FC0.0.0.31111 1111 1111 1111 1111 1111 1111 110042*
/31255.255.255.254FF FF FF FE0.0.0.11111 1111 1111 1111 1111 1111 1111 111022 on RFC 3021 point-to-point links
/32255.255.255.255FF FF FF FF0.0.0.01111 1111 1111 1111 1111 1111 1111 111111 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