Subnet Mask

Subnet Mask is a 32-bit number that is used to partition IP addresses into a network ID and a host ID. Subnet masks are used by TCP/IP services and applications to determine whether a given IP address on an internetwork is a local network address or a remote network address.

Subnet Mask Sheet
Subnet Mask Sheet

How It Works

Subnet masks are represented as four-octet dotted-decimal numbers, just as IP addresses are, except that the most common values for an octet in a subnet mask are 0 and 255. In binary notation, decimal 0 represents the octet 00000000, and decimal 255 represents 11111111.

A subnet mask consists of 32 binary digits, the first n of which are 1s and the remaining of which are 0s. When the subnet mask is logically ANDed with a 32-bit IP address of a TCP/IP host, the result is the network ID of the host – the portion of the host’s IP address that identifies which network the host is on. When the inverse of the subnet mask (for example, NOT mask) is logically ANDed with the IP address of the host, the result is the host ID of the host – the portion of the host’s IP address that uniquely identifies the host on its network.

For example, consider the IP address and the subnet mask Converting these two numbers to binary and ANDing them gives the host’s Network ID:

Host = 11001111 00111101 00010000 01110111
Mask = 11111111 11111111 11111111 00000000
AND = 11001111 00111101 00010000 00000000
= = network ID

Taking the logical NOT of the subnet mask and ANDing it with the host’s IP address gives the host’s Host ID:

Host = 11001111 00111101 00010000 01110111
NOT Mask = 00000000 00000000 00000000 11111111
AND = 00000000 00000000 00000000 01110111
= = host ID

Two types of subnet masks are used in TCP/IP networking:

  • Default subnet masks: Partition IP addresses into their network ID and host ID portions 
  • Custom subnet masks: Further partition the network ID into a number of separate subnets by using a process called subnetting 

Default subnet masks

The default subnet masks for IP address classes A, B, and C are shown in the following table. The table also shows how these subnet masks would partition an IP address such as w.x.y.z into a network ID and a host ID portion.

Default Subnet Masks for IP Addresses

ClassDefault Subnet MaskNetwork IDHost ID

Ascend routers

Some TCP/IP configuration programs, such as those for Ascend routers, use a different notation for specifying subnet masks. They append a suffix of the form /n to the host’s IP address to indicate the subnet mask, in which n equals the number of binary 1s in the subnet mask. Thus, for example, signifies

What is Subnet Mask?


Articles posted after being checked by editors.

Recent Posts