Subnet masks are used to separate the host ID and the network ID in an IP address. They consist of a 32-bit value expressed in dotted decimal notation and may also be called "address masks."
The rise of subnetting, or dividing an IP network into smaller networks, created the need for subnet masks to distinguish different portions of the network. All bits of the subnet mask that correspond to the network ID are set to 1, and all bits that correspond to the host ID are set to 0. Each of the nodes on a TCP/IP network is required to have a subnet mask.