What Is a Subnet Mask?

Written by Coursera Staff • Updated on

Subnet masks create subnets, which produce more efficient networking and routing. Learn more about subnets and their uses below.

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

A subnet mask separates 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 using CIDR (Classless Inter-Domain Routing) in 1993, only three subnet masks existed 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

Class-based routing features a fixed number of hosts and IP address numbers. With the introduction of CIDR in 1993, subnet masks broke down networks further to enhance the efficiency of creating IP addresses without wasting network space for entities that don’t need large quantities of host numbers. This process is subnetting, which is done by a network systems administrator. 

Use of subnet masks in subnetting

Let’s take a closer look at using subnet masks 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 class system's limitations. Classless routing removes the need to restrict networks to the class divides, and subnet masks are used to carve IP address network prefixes and host numbers up efficiently. 

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 a 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. 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.

  • Network administrator

  • DHCP

  • Router

  • TCP/IP

  • DDoS attack

Getting started in IT

Subnet masks separate more extensive networks into smaller “subnets” using numbers. This enhances the efficiency of routing and networking.

Explore the use of subnet masks further and learn how to create and maintain subnets in an organisation with the Google IT Support Professional Certificate on Coursera. This beginner-level course allows you to learn quickly and helps you acquire essential skills for an entry-level IT job. The Professional Certificate covers technical support fundamentals, operating systems, and 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.