Netmasks

A netmask is a 32 bit number, sometimes represented as 4 bytes, or octets, separated by dots. Valid netmasks, in binary, are a series of one's followed by zeros. I.e. You will never see a sequence of 101. Netmasks can also be represented in CIDR notation as a slash and the number of ones, out of 32, in the netmask. E.g. /24.

The number of available host addresses in a subnet is calculated by the following forumula:

hosts = 2 ^ 32 - CIDR

For example, a /24 subnet has 2 ^ 8 = 256 hosts.

CIDR Netmask Hex dotted quad Hosts Usable Comment
/32 1111111 11111111 11111111 11111111 FFFFFFFF 255.255.255.255 1 1 single host
/31 1111111 11111111 11111111 11111110 FFFFFFFE 255.255.255.254 2 2 ACL for 2 hosts
/30 1111111 11111111 11111111 11111100 FFFFFFFC 255.255.255.252 4 2 usually a WAN or PPP address
/29 1111111 11111111 11111111 11111000 FFFFFFF8 255.255.255.248 8 6 small static subnet
/28 1111111 11111111 11111111 11110000 FFFFFFF0 255.255.255.240 16 14 subnet
/27 1111111 11111111 11111111 11100000 FFFFFFE0 255.255.255.224 32 30 subnet
/26 1111111 11111111 11111111 11000000 FFFFFFC0 255.255.255.192 64 62 subnet
/25 1111111 11111111 11111111 10000000 FFFFFF80 255.255.255.128 128 126 subnet
/24 1111111 11111111 11111111 00000000 FFFFFF00 255.255.255.0 256 254 previously Class C
/23 1111111 11111111 11111110 00000000 FFFFFE00 255.255.254.0 512 510 supernet
/22 1111111 11111111 11111100 00000000 FFFFFC00 255.255.252.0 1024 1022 supernet
/21 1111111 11111111 11111000 00000000 FFFFF800 255.255.248.0 2048 2046 supernet
/20 1111111 11111111 11110000 00000000 FFFFF000 255.255.240.0 4096 4094 supernet
/19 1111111 11111111 11100000 00000000 FFFFE000 255.255.224.0 8192 4090 supernet
/18 1111111 11111111 11000000 00000000 FFFFC000 255.255.192.0 16384 16382 supernet
/17 1111111 11111111 10000000 00000000 FFFF8000 255.255.128.0 32768 32766 supernet
/16 1111111 11111111 00000000 00000000 FFFF0000 255.255.0.0 65536 65534 previously Class B

Following are a few examples of netmasks with base network and broadcast addresses. We use A.B.C.0 where the letters are not relevant to the rest of the addresses.

CIDR subnets base network broadcast
/28 16 nets of 16 hosts per /24 A.B.C.0 A.B.C.15
A.B.C.16 A.B.C.31
...skipping 12 of 16...
A.B.C.224 A.B.C.239
A.B.C.240 A.B.C.255
/27 8 nets of 32 hosts per /24 A.B.C.0 A.B.C.31
A.B.C.32 A.B.C.63
...skipping 4 of 8...
A.B.C.192 A.B.C.223
A.B.C.224 A.B.C.255
/26 4 nets of 64 hosts per /24 A.B.C.0 A.B.C.63
A.B.C.64 A.B.C.127
A.B.C.128 A.B.C.191
A.B.C.192 A.B.C.223
/25 2 nets of 128 hosts per /24 A.B.C.0 A.B.C.127
A.B.C.128 A.B.C.255
/24 256 hosts per net A.B.C.0 A.B.C.255
/23 128 nets of 512 hosts per /16 A.B.0.0 A.B.1.255
A.B.2.0 A.B.3.255
...skipping 124 of 128...
A.B.252.0 A.B.253.255
A.B.254.0 A.B.255.255
/22 64 nets of 1024 hosts per /16 A.B.0.0 A.B.3.255
A.B.4.0 A.B.7.255
...skipping 60 of 64...
A.B.248.0 A.B.251.255
A.B.252.0 A.B.255.255
/21 32 nets of 2048 hosts per /16 A.B.0.0 A.B.7.255
A.B.8.0 A.B.15.255
...skipping 28 of 32...
A.B.240.0 A.B.247.255
A.B.248.0 A.B.255.255
/20 16 nets of 4196 hosts per /16 A.B.0.0 A.B.15.255
A.B.16.0 A.B.31.255
...skipping 12 of 16...
A.B.224.0 A.B.239.255
A.B.240.0 A.B.255.255
/16 65536 hosts per net A.B.0.0 A.B.255.255
/8 16777216 hosts per net A.0.0.0 A.255.255.255