A subnet mask is a screen of numbers used for routing traffic within a subnet. Once a packet has arrived at an organization's gateway or connection point with its unique network number, it can be routed to its destination within the organization's internal gateways using the subnet number. The subnet mask consists of a screen of numbers indicating to the router which numbers it should look at underneath. In a binary mask, for example, a "1" over a number says "Look at the number underneath;" a "0" says "Don't look." Using a mask saves the router having to handle the entire 32 bit address; it can simply look at the bits selected by the mask.
Using the previous example (which is a very typical case), the combined network number and subnet number occupy 24 bits or three of the quads. The appropriate subnet mask carried along with the packet would be:
Or a string of all 1's for the first three quads (telling the router to look at these) and 0's for the host number (which the router doesn't need to look at). Subnet masking allows routers to move the packets on more quickly.
If you have the job of creating subnets for an organization (an activity called subnetting) and specifying subnet masks, your job may be simple or complicated depending on the size and complexity of your organization and other factors.