What Is a Subnet Mask?

Written by Coursera Staff • Updated on

Subnet masks produce more efficient networking and routing by creating subnets. In this article learn more about what subnets are and what they are used for.

[Featured image] An IT support specialist is researching subnet masking on their phone while standing outside.

A subnet mask seperates large networks into smaller subnets. Every IP address has a network prefix and a host number. In an IP address, a subnet mask is a number structured like an IP address that shows the start of the host number in the IP address. Before the use of CIDR (Classless Inter-Domain Routing) in 1993, there were only three subnet masks used with the three main IP (IPv4)  address classes. Class-based routing breaks down like this:

  • Class A network prefix: 8 bits, host number: 24 bits

  • Class B network prefix: 16 bits, host number: 16 bits

  • Class C network prefix: 24 bits, host number: 8 bits

The subnet mask for each class is defined here:

  • Class A subnet mask: 255.0.0.0

  • Class B subnet mask: 255.255.0.0

  • Class C subnet mask: 255.255.255.0

In class-based routing, there are a fixed amount of hosts and the number of the IP address. With the introduction of CIDR in 1993, subnet masks broke down networks further so that IP addresses could be more efficiently created without wasting network space for entities that don’t need large quantities of host numbers. This process is subnetting and is done by a network systems administrator

Read more: Information Technology (IT) Terms: A to Z Glossary

Use of subnet masks in subnetting

Let’s take a closer look at how a subnet mask is used to break down classes in CIDR. In class-based routing, each class has a specific number of hosts that can connect to a network:

  • Class A for networks containing over 65,536 hosts

  • Class B for networks containing 256 to 65,534 hosts

  • Class C for networks containing less than 254 hosts

If your business has 1,000 devices that connect to the internet, you would need a class B but would be wasting IP addresses because of the limitation of the class system. Classless routing removes the need to restrict networks to the class divides and subnet masks are the tool used to carve IP address network prefixes and host numbers up in an efficient way. 

Below is an example of how a subnet mask creates an IP address with a more efficient number of host numbers.

Take, for example, a typical class C IP address of 192.168.1.0 and subnet mask of 255.255.255.0. However, you don’t need 254 host devices, only half of that number, so you need to create a subnet mask to do this. In order to get to half, you will need to borrow one bit from the original subnet mask so the mask becomes 255.255.255.128 (11111111.11111111.11111111.10000000 in binary), which gives you two subnets and 128 minus two for the reserved IP addresses, so 126 hosts. 

In CIDR notation the IP address is: 192.168.1.0/25. The “slash 25” indicates that the IP address contains a subnet mask with 25 bits.

Getting started in IT

To learn more about how to use subnet masks to create and maintain subnets in an organization, consider the Google IT Support Professional Certificate on Coursera. This beginner-level course allows you to learn at your own pace and helps you acquire essential skills for an entry-level IT job. The Professional Certificate covers technical support fundamentals, operating systems, and system administration.  

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.