What Is a Subnet Mask? CIDR & Subnetting Explained
A subnet mask is the quiet companion to every IP address that decides which part is the network and which part is the device. Once you see how it works, CIDR notation and subnetting stop being intimidating.
What is a subnet mask?
A subnet mask is a number, paired with an IP address, that marks where the network portion of the address ends and the device portion begins. Every IP address is really two things bundled together: an identifier for the network it belongs to and an identifier for the specific device on that network. The subnet mask is what draws the line between the two.
A typical home subnet mask looks like 255.255.255.0. Read alongside an address like 192.168.1.5, it says the first three numbers identify the network and the last number identifies the device.
How the mask splits an address
Under the hood, both the IP address and the subnet mask are 32-bit numbers. In the mask, the bits set to 1 mark the network part and the bits set to 0 mark the device (or host) part. Where the mask has ones, the address bits are locked as the network; where it has zeros, the address bits are free to vary per device.
Take 255.255.255.0. Each 255 is eight ones, so the first 24 bits are the network and the final 8 bits are the host. That leaves room for a range of device addresses on the same network, with two values reserved: one for the network itself and one as the broadcast address.
When your device wants to send data, it uses the subnet mask to check whether the destination is on the same local network. If it is, the data goes directly. If not, the data is handed to your router to forward toward the internet.
CIDR notation: the shorthand
Writing out 255.255.255.0 every time is tedious, so networking uses a shorthand called CIDR notation (Classless Inter-Domain Routing). It appends a slash and a number to the address showing how many bits belong to the network.
So 192.168.1.0/24 means the first 24 bits are the network, which is exactly the same as a subnet mask of 255.255.255.0. The number after the slash is simply the count of one-bits in the mask.
| CIDR | Subnet mask | Usable device addresses |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /16 | 255.255.0.0 | 65,534 |
Notice the pattern: a larger number after the slash means more bits reserved for the network and therefore fewer devices per subnet. CIDR notation replaced an older, rigid system of address "classes" and made it possible to allocate address space far more flexibly.
What is subnetting?
Subnetting is the practice of dividing one network into smaller sub-networks by adjusting the mask. Instead of one large flat network, an administrator can carve out several smaller ones, each with its own range of addresses.
Why bother? Subnetting brings real benefits:
- Organisation. Different departments, floors, or device types can each get their own subnet.
- Less noise. Keeping local chatter within a subnet reduces unnecessary traffic across the whole network.
- Control. Rules and access policies can be applied per subnet rather than to everything at once.
- Efficiency. Address space is used tidily instead of being wasted on one oversized block.
Borrowing more bits for the network from the host portion creates more subnets, each with fewer devices. This flexibility is a big part of why IPv4 address space could be stretched as far as it was.
A quick worked example
Suppose your home network is 192.168.1.0/24 with a mask of 255.255.255.0. The network portion is 192.168.1, and devices take the final number, so your laptop might be 192.168.1.5 and your phone 192.168.1.6. Both share the same network portion, so your devices know they are local to each other and can talk directly.
When your laptop instead requests something at 93.184.example, the mask reveals a different network portion, so the request is sent to the router to forward onward. That simple comparison, repeated constantly, is the everyday job of the subnet mask.
Do you need to think about this?
For everyday browsing, no. Your router and DHCP handle subnet masks for you automatically. But understanding them demystifies a lot of network settings, and it explains why addresses like 192.168.1.x all belong to one household network.
Want to see your own public address in action? The friendly checkers at IP Animals will show you the address your network presents to the world, the counterpart to all this local subnet arithmetic.
Frequently asked questions
What is a subnet mask in simple terms?
A subnet mask is a number that splits an IP address into two parts: the part that identifies the network and the part that identifies the device on it. It is how a device decides whether another address is on the same local network or somewhere out on the internet.
What does 255.255.255.0 mean?
It is a common subnet mask meaning the first three numbers of the address identify the network and the last number identifies the device. On a network like 192.168.1.x, it allows for 254 usable device addresses.
What is CIDR notation?
CIDR notation writes the subnet mask as a slash and a number, such as /24, showing how many bits belong to the network. So 192.168.1.0/24 is the same as a subnet mask of 255.255.255.0.
Why do networks use subnetting?
Subnetting divides a large network into smaller, more manageable pieces. This improves organisation, reduces unnecessary traffic, and lets administrators apply different rules to different segments, all while using address space efficiently.