What Is a Subnet Mask and Why Does It Matter?
Every device connected to the internet has an IP address, but that’s only part of the story. To really understand how devices communicate on a network, you also need to know about subnet masks.
A subnet mask is a number that tells your device which part of an IP address is the network and which part is the device. If you’ve ever looked at your network settings and seen something like 255.255.255.0, you’ve seen a subnet mask in action. But what does that actually mean?
We’ll break down how subnet masks work, why they matter, and where you’ve probably used one without realizing it.
What Is a Subnet Mask?

A subnet mask is a number that tells devices which part of an IP address refers to the network and which part refers to a specific device on that network.
You can think of a subnet mask like a digital zip code system for your network. Just like a zip code helps mail carriers figure out which part of the city a letter belongs to, a subnet mask helps your device decide where an IP address (or a device) is.
The subnet mask separates an IP address into two parts:
- Network: Identifies what network the IP address belongs to (like a zip code).
- Host: Identifies the specific device (like a house number).
This helps devices know whether they can communicate directly or need help from the router.
How Does a Subnet Mask Work?
Let’s look at an example on a local network: You’re sending a file from your laptop with an IP address of 192.168.1.10 to a printer with an IP address of 192.168.1.25. Without more information, your laptop can’t tell the network or host from the IP address. It’s essentially just a string of numbers.
That’s where the subnet mask comes in. Let’s say the subnet mask for the laptop and printer IPs is 255.255.255.0.
- 255 means network.
- 0 means host.
So in 255.255.255.0, the first three numbers (192.168.1) represent the network, and the last number identifies the host (device).
To the laptop, it means this: “Both addresses share 192.168.1; they’re on the same local network. You can find the printer by looking at the number ‘25.’”
Your laptop then sends the file directly to the printer.
If the printer had a different address, say 192.168.2.5, with the same subnet mask of 255.255.255.0, the subnet mask would tell your laptop:
“This is not part of your local network (which is 192.168.1.0) – send the data to the router or VPN (virtual private network) if you’re using one.” The router or the VPN then figures out how to forward that data across the internet.
What Is a Subnet Mask Used For?

A subnet mask defines how devices communicate. Without a subnet mask, IP addresses are just numbers. Devices wouldn’t know how to route traffic, and the entire network would stop functioning.
Here are some of the top uses for a subnet mask:
Allow Smart Routing of Data
A subnet mask for Wi-Fi and wired networks helps devices decide where to send data. If you’re streaming a video to your smart TV or printing a document from your laptop, the subnet mask tells your device, This is local, send it directly. But if you’re loading a website or connecting to your VPN, the subnet mask signals, This is remote, send it through the router.
Limit Broadcast Noise
Without subnet masks, every message sent on a network could reach every device. It’s like yelling across an entire office building when you just want to talk to someone at the next desk. By limiting this broadcast domain, only relevant devices hear each message, and the network stays fast and focused.
Use IP Addresses Efficiently
Subnet masks allow large networks to be broken into smaller pieces. This means IP addresses are assigned more efficiently, avoiding waste. It’s useful in both large networks with thousands of devices and smaller ones like home networks with many smart devices (where even a fridge or a light bulb might need an IP address).
Improve Security Through Segmentation
By separating networks into subnets, you can limit which devices can talk to each other. For example, if someone connects to your guest Wi-Fi, they can access the internet — but they won’t be able to access your printer or smart home devices. In business networks, subnetting lets you separate sensitive systems like payroll or security cameras from general employee access, reducing the chances of internal threats.
What Is CIDR Notation for Subnet Masks?
CIDR (Classless Inter-Domain Routing) is a shorthand way of writing subnet masks. Instead of writing the entire subnet mask for an IP address (like 255.255.255.0), you use a slash followed by the number of network bits.
For example, let’s say that this IP address 192.168.1.30 has a 255.255.255.0 subnet mask. That’s a lot of numbers to type (and it’s easier to make a mistake!).
Instead, I can just write 192.168.1.30/24. This means the first 24 bits (or the first 3 sets of numbers in the 32-bit IP address) represent the network, and the remaining 8 bits are for hosts. In other words, 192.168.1 is the network portion, and the 30 is the host.
Why Is CIDR Important?
CIDR lets you split a network into smaller parts, called subnetting, or combine networks into a larger one, called supernetting. Subnetting helps you organize and isolate parts of a network, like splitting a company’s IP space across different departments. Supernetting reduces the number of routes a router has to manage by grouping similar networks together.
Subnet Mask by IP Class: What Are the Different Types of IP Classes?
In the early days of networking, the subnet mask was automatically decided based on which IP class the IP address belonged to. This class-based system for IP addresses was just a way to divide IP addresses based on network size.
Each class had a default subnet mask and a specific range of IP addresses. You could tell which class an IP address belonged to by looking at its first octet (the first number in the address).
Class A
An IP address is in the classful Class A IP range if its first octet is between 0 and 127. The default subnet mask for a Class A IP address is 255.0.0.0, or /8 in CIDR, meaning the first 8 bits (or the first octet) are used to identify the network, while the remaining 24 bits are used for hosts.
Example IP: 10.25.14.1
What it means:
- Network portion: First 8 bits (10)
- Host portion: Remaining 24 bits (25.14.1)
Class B
Class B IP addresses have a first octet in the numbers between 128 and 191. The default subnet mask for Class B is 255.255.0.0 or /16 in CIDR, which means the first two octets (16 bits) are used for the network portion, and the remaining two octets are for host devices.
Example IP: 172.16.50.5
What it means:
- Network portion: First 16 bits (172.16)
- Host portion: Last 16 bits (50.5)
Class C
The first octet of a Class C IP address falls between 192 and 223. The default subnet mask for a Class C network is 255.255.255.0, which is written as /24 in CIDR notation.
Example IP: 192.168.1.10
What it means:
- Network portion: First 24 bits (192.168.1)
- Host portion: Last 8 bits (10)
Why Do We No Longer Use IP Classes in Networking?
While simple enough to remember for network admins, the class-based system was too limiting and wasteful. It only gave you a few fixed subnet sizes, like 254 hosts in Class C or 65,000+ in Class B – with nothing in between.
If, say, your network needs 1,000 addresses, your only option in the class-based system is taking a huge block of IP addresses and wasting most of it, or try to piece together smaller ones. This is why CIDR is the default now created – it allows networks to be sized more precisely.
Subnet Mask Calculator: What Is It and How to Use It
A subnet mask calculator is a tool that automates the process of subnetting by calculating important information such as network or broadcast addresses and IP ranges. All you have to do is provide it with either an IP address and a subnet mask or CIDR notation, and it will show you the:
- Network address
- Broadcast address
- Range of usable IP addresses
- Number of assignable hosts
- Subnet mask in both decimal and CIDR notation
- IP class (legacy reference only)
Some calculators also include:
- Subnet range breakdowns when splitting a larger network
Example: Break 192.168.0.0/22 into four /24 subnets: 192.168.0.0/24, 192.168.1.0/24, etc.
- CIDR block planning for precise address allocation
Example: Choose /27 to allocate 32 IPs per subnet (including network and broadcast).
- IPv4 to IPv6 conversion tools for network migration
Example: Convert 192.168.1.1 to ::ffff:192.168.1.1
Subnet Mask Cheat Sheet
If you’re not sure how to choose the right subnet size for your network, use this cheat sheet to match the number of devices to the correct CIDR block.
| CIDR | Subnet Mask | Total IPs | Usable Hosts | Wildcard Mask | IP Block Size | Good For |
| /30 | 255.255.255.252 | 4 | 2 | 0.0.0.3 | 4 IPs | Point-to-point links (example: router-to-router) |
| /29 | 255.255.255.248 | 8 | 6 | 0.0.0.7 | 8 IPs | Small WAN links or very small device clusters |
| /28 | 255.255.255.240 | 16 | 14 | 0.0.0.15 | 16 IPs | Small office networks (example: printers, cameras) |
| /27 | 255.255.255.224 | 32 | 30 | 0.0.0.31 | 32 IPs | Small LAN segments or isolated VLANs |
| /26 | 255.255.255.192 | 64 | 62 | 0.0.0.63 | 64 IPs | Medium LANs or guest Wi-Fi networks |
| /25 | 255.255.255.128 | 128 | 126 | 0.0.0.127 | 128 IPs | Small departments |
| /24 | 255.255.255.0 | 256 | 254 | 0.0.0.255 | 256 IPs | Standard LAN size for most networks |
| /23 | 255.255.254.0 | 512 | 510 | 0.0.1.255 | 512 IPs | Medium-sized networks |
| /22 | 255.255.252.0 | 1,024 | 1,022 | 0.0.3.255 | 1,024 IPs | Good for campus networks or data centers |
| /21 | 255.255.248.0 | 2,048 | 2,046 | 0.0.7.255 | 2,048 IPs | Large subnets with many devices or services |
| /20 | 255.255.240.0 | 4,096 | 4,094 | 0.0.15.255 | 4,096 IPs | Large enterprise networks or regional offices |
| /19 | 255.255.224.0 | 8,192 | 8,190 | 0.0.31.255 | 8,192 IPs | Service provider edge networks |
| /18 | 255.255.192.0 | 16,384 | 16,382 | 0.0.63.255 | 16,384 IPs | Aggregation layers in ISPs or very large sites |
| /17 | 255.255.128.0 | 32,768 | 32,766 | 0.0.127.255 | 32,768 IPs | Large hosting environments or ISP subnets |
| /16 | 255.255.0.0 | 65,536 | 65,534 | 0.0.255.255 | 65,536 IPs | Large organizations or internal backbone networks |
How Subnet Masks Affect VPN Connections
When you connect to a VPN, your internet traffic gets routed through an encrypted tunnel to a secure server. But behind that smooth experience, subnet masks and IP routing play a key role in how that traffic is handled — and occasionally they cause problems.
Subnet Overlap: A Common VPN Headache
Let’s say your home Wi-Fi uses the IP range 192.168.1.0/24. That’s a common default for many routers. Now imagine your VPN assigns you an IP in that same range, for example 192.168.1.x, and it has the same subnet mask.
The problem is your device can’t tell the difference between your local network and the VPN’s remote network. This is a subnet overlap, and it leads to routing confusion, such as:
- You might lose access to local devices like your printer or NAS (Network Attached Storage).
- Remote work resources might stop loading.
- Some traffic may leak outside the VPN tunnel or not route at all.
PIA VPN’s network is designed to minimize these conflicts by assigning VPN IP address ranges that are unlikely to overlap with most home routers. But in rare cases, especially with corporate VPNs or self-hosted setups, you might still run into issues.
What You Can Do About It
If you’re having trouble connecting to work resources or can’t access your local devices while the VPN is active, try this:
- Change your home network subnet to something less common, like 192.168.50.0/24 or 10.88.0.0/16.
- Use split tunneling in the PIA VPN app if you want certain apps or IP ranges to bypass the VPN.
- Check your routing table to confirm how traffic is being handled.
What Is My Subnet Mask? How to Check on Any Device
You don’t need to be a network engineer to check your subnet mask. Whether you’re troubleshooting a connection or just curious, it’s easy to find on any device. Here’s how to do it in a few quick steps.
Windows
- Press Windows + R, type cmd, and hit Enter to open the Command Prompt.
- Type ipconfig and press Enter.
- Look under your active connection — the subnet mask will appear right below your IP address.

macOS
- Open System Settings > Network.
- Select your active connection (Wi-Fi or Ethernet) and click Details or Advanced.
- Under the TCP/IP tab, you’ll see the subnet mask next to your IP address.

Linux
- Open a terminal window.
- Type ip addr show or ifconfig (depending on your distro).
- Look for your active interface – the subnet mask will be shown as a CIDR (like /24) or in the netmask field.
Android
- Go to Settings > Network & Internet > Wi-Fi.
- Tap the gear icon next to your connected Wi-Fi network.
- Tap Advanced, change your IP settings from DHCP to Static, and the Subnet Mask (or “Network Prefix Length”) will be listed.

iOS (iPhone/iPad)
- Open Settings > Wi-Fi.
- Tap the ⓘ icon next to your connected network.
- Scroll down and you’ll see Subnet Mask along with your IP and router address.

FAQ
What is a subnet mask and why is it used in networking?
A subnet mask is a numerical value that separates the network and host parts of an IP address. It tells devices whether another IP is on the same local network or if the data should be routed elsewhere. This helps manage traffic efficiently and reduces unnecessary communication between unrelated devices.
How does a subnet mask work with an IP address?
A subnet mask works alongside an IP address by defining which portion identifies the network and which portion identifies the device (host). The combination helps your device decide if it can reach another IP directly or needs to go through a router. It’s essential for accurate and efficient routing.
What’s the difference between a subnet mask and a default gateway?
A subnet mask defines which IP addresses are part of your local network, while a default gateway is the IP address of the device that routes traffic outside of that network. Think of the subnet mask as drawing a boundary and the gateway as the door that leads beyond it. Both are essential for proper network communication.
How can I find the subnet mask on my device?
You can usually find your subnet mask in the network settings of your device. On Windows, use the ipconfig command in Command Prompt; on macOS or Linux, use ifconfig or check network preferences. On mobile devices, it’s listed under your Wi-Fi connection details.
Do home networks need to change their default subnet mask settings?
In most cases, no. Home routers are typically set to use 255.255.255.0 (/24), which supports up to 254 devices, which is more than enough for most households. Changing it can cause unnecessary configuration issues unless you have a specific networking need.