What is a subnet mask?
A subnet mask is a number that, paired with an IP address, defines which portion of that address identifies the network and which portion identifies the individual device on it — commonly written as 255.255.255.0 or in CIDR shorthand as /24.
Take a typical home network: IP address 192.168.1.50 with subnet mask 255.255.255.0. The mask tells every device that the first three numbers (192.168.1) identify the network, and only the last number (50) varies between devices. That means up to 254 devices can share that network (1 through 254 — 0 and 255 are reserved), and any device with an IP starting 192.168.1.x is considered "local" and reachable directly, without needing to go through the gateway.
The CIDR notation (/24, /16, /8) is a shorthand for the same information — the number after the slash is how many bits of the address are the "network" portion. /24 means the first 24 bits (3 of the 4 numbers in an IPv4 address) are fixed as the network, leaving 8 bits (254 usable addresses) for devices. A smaller number after the slash means a bigger network with more possible device addresses; a larger number means a smaller network.
Getting the subnet mask wrong is a common cause of "can't reach a device on my own network" problems — if two devices have masks that disagree about what counts as "local," they may try to route to each other through the gateway instead of talking directly, or fail to find each other at all.
FAQ
- What's the most common home subnet mask?
- 255.255.255.0 (equivalent to /24), which supports up to 254 devices — more than enough for a typical home network. Most consumer routers use this by default.
- Do I need to change my subnet mask?
- Almost never, for a home network. The default is sufficient unless you're deliberately segmenting a large network (e.g. separating IoT devices from your main network) or running more than ~250 devices, which is rare outside business settings.
- What's the difference between a subnet mask and a default gateway?
- The subnet mask defines the boundaries of your local network (which addresses count as "local"). The default gateway is the specific address traffic gets sent to when it's leaving that local network. They work together but answer different questions.