What Is a Subnet Mask? Simple Beginner’s Guide 2026

1
What Is a Subnet Mask? Simple beginner’s guide to IP networking and subnet masks

A subnet mask is a 32-bit number that tells a device which part of an IPv4 address points to the network and which part points to the device itself. That’s the quick answer. The rest of this guide shows how it works, how to read one, and why your laptop can reach the printer down the hall directly but sends everything else to the router.

What Is a Subnet Mask?

Every IPv4 address does two jobs at once. One part names the network. The other part names a single device on it. The mask draws the line between them.

It looks like an IP address: four numbers split by dots, like 255.255.255.0. Underneath, it’s 32 bits, a run of 1s followed by a run of 0s. Every 1 marks a network bit. Every 0 marks a host bit.

The IETF described this method in 1985 in RFC 950, the Internet Standard Subnetting Procedure. It’s old, but nothing has replaced it. Routers, phones, and smart TVs still rely on it today.

How Does a Subnet Mask Work?

Devices combine the address and the mask using a bitwise AND. Take a laptop at 192.168.1.25 with a mask of 255.255.255.0. Line them up in binary:

  • IP address: 11000000.10101000.00000001.00011001
  • Mask: 11111111.11111111.11111111.00000000
  • Result: 11000000.10101000.00000001.00000000

The result, 192.168.1.0, is the network address. The leftover last number, 25, identifies the host.

Now the useful part. When the laptop wants to reach 192.168.1.40, it runs the same math on the destination. Same network address? Then it sends the data straight across. If the target is 8.8.8.8, the answer differs, so the laptop hands the traffic to its default gateway instead. One comparison, repeated millions of times a day on a busy network.

Common Subnet Masks and Host Counts

Here’s a cheat sheet worth bookmarking.

CIDRSubnet maskUsable hosts
/8255.0.0.016,777,214
/16255.255.0.065,534
/24255.255.255.0254
/26255.255.255.19262
/28255.255.255.24014
/30255.255.255.2522

The host formula is 2 to the power of the host bits, minus 2. Two addresses are reserved: the network address and the broadcast address. A /24 has 8 host bits, so 256 addresses, and 254 you can actually assign.

Subnet Mask vs. CIDR Notation

You’ll often see 192.168.1.0/24 instead of a dotted mask. The /24 just counts the 1s, so it’s the same information in fewer characters. RFC 4632 defines CIDR, which retired the rigid Class A, B, and C system back in the 1990s. Older textbooks still lean on classes, but real networks ignore them. A /26 works on any address range you like.

Why Subnet Masks Matter

Without masks, every device would sit on one giant network, and broadcast traffic would swamp everything. Carving a network into subnets keeps chatter local and makes troubleshooting easier. It also lets you separate guest Wi-Fi from payroll computers.

Then there’s address efficiency. A ten-person office doesn’t need a /16 with 65,534 hosts. A /28 gives 14 usable addresses and leaves the rest of your range free.

Common Subnet Mask Mistakes

Mismatched masks. One device on 255.255.255.0 and another on 255.255.0.0 will disagree about who’s local. Pings succeed one way and fail the other, which is maddening to debug.

Forgetting the reserved pair. Need 16 devices? A /28 looks perfect, but it only gives 14 usable addresses. You’d need a /27.

Invalid masks. Something like 255.0.255.0 isn’t legal, because the 1s must be contiguous.

Assuming 255.255.255.0 everywhere. It’s the default on most home routers, but it isn’t a rule. Always check.

1 thought on “What Is a Subnet Mask? Simple Beginner’s Guide 2026”

Leave a Reply

Your email address will not be published. Required fields are marked *