Variable-Length Subnet Masks
The following table shows how an 8-bit address range (3 octets) can be broken up into smaller subnets. The numbers in each column are the values possible for the fourth octet of a subnet under the stipulation that the subnet mask consists of contiguous ones.

For example, the 10-bit subnets possible in the 8-bit range X.Y.Z are: X.Y.Z.0, X.Y.Z.64, X.Y.Z.128, or X.Y.Z.192 The mask for a 10-bit subnet is 255.255.255.192. (The inverse mask is the ones-complement of the mask, and is used in some cases in routers.)
The row "# Addresses" indicates the total number of addresses in a subnet. However, three addresses are not available:
- The base number is the subnet number and cannot be assigned.
- The next number is assigned to the router under most circumstances, and is the default gateway.
- The last number (next number down the column, minus 1) is the broadcast address and cannot be assigned.
Note: If the subnet is the last in the column, the broadcast address is 255. So, for example, a 14-bit subnet has only one assignable address in addition to the router address.
Example:
The 12-bit subnet X.Y.Z.80 is assigned. Therefore:
The mask is 255.255.255.240.
The router address (default gateway) is X.Y.Z.81.
The broadcast address is X.Y.Z.95 (the next number down the column, minus 1).
There are 13 addresses available (X.Y.Z.82 through X.Y.Z.94).
An 8-bit range can be divided into different subnet sizes.
For example, X.Y.Z can be broken into:
X.Y.Z.0 (255.255.255.252)
X.Y.Z.4 (255.255.255.252)
X.Y.Z.8 (255.255.255.248)
X.Y.Z.16 (255.255.255.248)
X.Y.Z.24 (255.255.255.248)
X.Y.Z.32 (255.255.255.224)
X.Y.Z.64 (255.255.255.192)
X.Y.Z.128 (255.255.255.128)
Although this example starts with smaller subnets at the bottom of the range, this is not required. However, for contiguous-ones masks, each subnet must be specified only with a fourth octet chosen from the numbers in the column of the chosen subnet size.
For example, if the 14-bit subnet X.Y.Z.0 (255.255.255.252) were already assigned, and a 12-bit subnet were then needed, the next available subnet is X.Y.Z.16. X.Y.Z.4 must be used as a 14-bit subnet. The space between 8 and 16 could be used as one 13-bit subnet or two 14-bit subnets.
Phil Devan
TNS - 01 July 1996






