What Is a Subnet Mask?
If you’ve ever opened your network settings and spotted a string like 255.255.255.0 next to your IP address, you’ve seen a subnet mask. It’s the piece of information that tells a device which part of an IP address identifies the network and which part identifies the individual device on that network. It sounds technical, but the idea behind it is simple, and understanding it makes everything else about home and office networking easier to follow.
In this guide, we’ll break down what a subnet mask is, how it works with IP addresses, why subnetting exists, and how you can work out your own without a networking degree.
What a Subnet Mask Does: Splitting an IP Address Into Network and Host
Every device connected to a network, whether it’s your laptop, your phone, or your router, needs an IP address to send and receive data. But an IP address on its own doesn’t tell a device everything it needs to know. It needs a way to figure out which devices are on its own local network and which ones are on another network entirely.
That’s the job of a subnet mask. It works alongside the IP address to divide it into two parts: the network portion and the host portion. The network portion identifies which network a device belongs to. The host portion identifies that specific device within the network. When a device wants to send data, it compares the destination IP address against its own IP address and mask to decide whether the target is on the same network or needs to be routed elsewhere.
Put another way, it’s how a device answers a simple question: “Is this device on my network, or do I need to send this data through a router to reach it?”
How a Subnet Mask Works With IPv4 Addresses
An IPv4 address is a 32-bit number, usually written as four numbers separated by dots (like 192.168.1.10), where each number is called an octet. A subnet mask is also a 32-bit number, written in the same dotted format, and it lines up directly with the IP address, bit for bit.
In binary, it’s a string of 1s followed by a string of 0s. The 1s mark the network portion of the address, and the 0s mark the host portion. So a subnet mask of 255.255.255.0 in binary is 11111111.11111111.11111111.00000000 — the first three octets (24 bits) are all 1s, meaning they define the network, and the last 8 bits are 0s, meaning they’re used for the host.
This is the core mechanic behind how IP addresses are divided into a network and host: it simply tells a device where that dividing line sits.
Subnet Mask Notation: Dotted Decimal vs. CIDR
You’ll typically see a subnet mask written in one of two ways.
The first is dotted decimal notation, which looks like a regular IP address: 255.255.255.0. The second is CIDR notation (Classless Inter-Domain Routing), which appends a slash and a number to the IP address, like 192.168.1.0/24. That /24 simply means the first 24 bits of the address are used for the network — the same information as 255.255.255.0, just written more compactly.
CIDR notation has become the standard way network engineers and configuration tools refer to these values, since it’s shorter and makes the number of bits used for the network immediately obvious.
Network Classes and Common Subnet Masks
Before CIDR became widespread, IP addresses were grouped into network classes, and each class came with a default mask.
A Class A network uses a default mask of 255.0.0.0, giving it a huge number of possible host addresses — useful for very large networks. A Class B network uses 255.255.0.0, offering a middle ground. A Class C network uses 255.255.255.0, which is by far the most common subnet mask you’ll encounter on home and small office networks, since it fits comfortably sized local networks.
With a Class C network and a subnet mask of 255.255.255.0, the last octet is reserved for host addresses, giving you 256 total addresses in that range. Subtract one for the network address and one for the broadcast address, and you’re left with 254 usable host addresses — enough for most home setups, where you might have a handful of laptops, phones, smart TVs, and other devices connected at once.
Subnetting: Why You’d Divide a Network Into Subnets
Subnetting is the practice of taking one larger network and splitting it into smaller subnets. Why bother? A few practical reasons come up again and again:
Organizations often want to separate different departments, device types, or locations into their own subnets for easier management and better security — keeping guest Wi-Fi traffic apart from internal company devices, for example. Smaller subnets also cut down on broadcast traffic, since broadcast messages only need to reach the devices within a single subnet rather than an entire large network. And subnetting lets network administrators use their available IP address space more efficiently, since not every network needs hundreds of usable host addresses.
Adjusting the mask is what makes different subnet sizes possible. A “longer” mask (more 1s) creates smaller subnets with fewer usable hosts. A “shorter” mask (fewer 1s) creates larger subnets with more hosts. This flexibility is the entire use of subnet masks in real-world network design: matching the size of a network to how it’s actually going to be used.
Subnet Mask, Default Gateway, and Routing Tables
A subnet mask rarely works alone. It usually shows up alongside two other settings: an IP address and a default gateway.
The default gateway is typically your router — the device responsible for forwarding traffic between your local network and other networks, including the internet. When your device wants to reach an IP address outside its own subnet, it sends that traffic to the default gateway, which then figures out where it needs to go next using its routing table. A routing table is essentially a list of known networks and the paths to reach them.
So the subnet mask is used at the very first step of that process: your device checks whether the destination IP address is within the same network as your own IP address. If it is, the data goes directly to that device on the local network. If it isn’t, the data gets sent to the default gateway for further routing.
How to Calculate Your Subnet Mask (Subnet Mask Calculator)
You don’t need to do complicated binary math by hand every time you need this information — an online calculator can instantly convert between dotted decimal notation, CIDR notation, and the number of usable hosts a given subnet supports. That said, it helps to understand the logic behind the calculator:
Start with your IP address and note how many bits you want to dedicate to the network portion. Count that many 1s from the left of a 32-bit number, fill the rest with 0s, and convert each group back into decimal. The result is your subnet mask. To find the number of usable hosts, take the number of bits left for the host portion, raise 2 to that power, and subtract 2 (one for the network address, one for the broadcast address).
For example, a network built on 192.168.1.0 and subnet mask 255.255.255.0 gives you 8 host bits, or 2^8 − 2 = 254 usable addresses — matching the common Class C setup mentioned earlier. If you needed a smaller subnet, say for a handful of devices, you could extend the mask further and shrink the available address range accordingly.
Where Subnet Masks Fit Into Your Everyday Network (and VPN) Setup
Most people never need to manually calculate one. Routers and internet service providers usually configure this automatically. But understanding it does help make sense of other networking and privacy concepts you’ll come across, including how a VPN changes the way your device communicates on the internet.
For instance, when you connect to a VPN, your device is often assigned a new IP address on the VPN provider’s own network, effectively placing you within a different network and subnet than your home ISP would normally assign. If you’re curious about the basics of how that connection works, our guide on what a VPN is and how to use one is a good starting point.
Subnetting also plays a role in how local network traffic stays separate from what gets routed out to the wider internet, which ties into broader questions about privacy and security.
Try Planet VPN
Understanding how your network is structured is a great first step toward taking your online privacy into your own hands. Planet VPN builds on that foundation by encrypting your connection and routing your traffic through secure servers, so your activity stays private no matter which network or subnet you’re connected from.
Check out our plans to see what’s included for free.
FAQ
Is 255.255.255.0 a subnet mask?
Yes. 255.255.255.0 is one of the most common subnet masks in use, especially on home and small office networks. It corresponds to a /24 in CIDR notation and reserves the last octet of the IP address for host addresses, giving you 254 usable addresses on that network.
What is a subnet mask and why is it used?
A subnet mask is a 32-bit number that works alongside an IP address to divide it into a network portion and a host portion. It’s used so that devices can quickly determine whether another IP address belongs to their own local network or to a different network that needs to be reached through a router. Without it, devices would have no reliable way to know where to send data directly and where to route it elsewhere.
What is your subnet mask?
Your subnet mask is a setting assigned to your device, usually automatically by your router or ISP, alongside your IP address and default gateway. You can find it on most devices by checking the network or Wi-Fi settings — on Windows, for example, running “ipconfig” in Command Prompt shows your current IP address, subnet mask, and default gateway together.
What is the subnet mask for a 192.168 network?
Home routers using an IP address in the 192.168.x.x range almost always use a subnet mask of 255.255.255.0 by default. This creates a Class C-style network that supports up to 254 usable host addresses, which comfortably covers the number of devices found on most home networks.