If you have ever configured a network device, you have probably seen a subnet mask like 255.255.255.0 and wondered what it means. Subnet masks are a fundamental part of how IP networking works, and understanding them is essential for anyone managing a network, setting up servers, or working in IT.
What Does a Subnet Mask Do?
A subnet mask determines which part of an IP address identifies the network and which part identifies the individual device (host) on that network. Think of it like a postal address: the city name identifies the general area (network), and the street address identifies the specific house (host).
When a device wants to communicate with another device, the subnet mask tells it whether the destination is on the same local network or if the traffic needs to be sent through a router (gateway) to reach a different network.
How Subnet Masks Work
An IPv4 address is 32 bits long, written as four octets (e.g., 192.168.1.100). The subnet mask is also 32 bits, and it divides the address into two parts:
- Network portion — Identified by 1s in the binary subnet mask
- Host portion — Identified by 0s in the binary subnet mask
Example
| Component | Decimal | Binary |
|---|---|---|
| IP Address | 192.168.1.100 | 11000000.10101000.00000001.01100100 |
| Subnet Mask | 255.255.255.0 | 11111111.11111111.11111111.00000000 |
| Network Address | 192.168.1.0 | 11000000.10101000.00000001.00000000 |
| Host Part | 0.0.0.100 | 00000000.00000000.00000000.01100100 |
The subnet mask 255.255.255.0 means the first 24 bits are the network portion and the last 8 bits identify individual devices. This allows up to 254 usable host addresses (256 minus the network address and broadcast address).
CIDR Notation
Instead of writing out the full subnet mask, network professionals use CIDR (Classless Inter-Domain Routing) notation. A slash followed by a number indicates how many bits are used for the network portion:
| CIDR | Subnet Mask | Usable Hosts | Common Use |
|---|---|---|---|
| /32 | 255.255.255.255 | 1 | Single host (used in whitelisting) |
| /24 | 255.255.255.0 | 254 | Small networks, home LANs |
| /16 | 255.255.0.0 | 65,534 | Medium networks |
| /8 | 255.0.0.0 | 16,777,214 | Large networks |
For example, 192.168.1.0/24 represents all addresses from 192.168.1.0 to 192.168.1.255. This notation is used extensively in firewall rules, IP whitelisting, and cloud infrastructure configuration.
Common Subnet Masks
| CIDR | Subnet Mask | Total Addresses | Usable Hosts |
|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 |
| /29 | 255.255.255.248 | 8 | 6 |
| /28 | 255.255.255.240 | 16 | 14 |
| /27 | 255.255.255.224 | 32 | 30 |
| /26 | 255.255.255.192 | 64 | 62 |
| /25 | 255.255.255.128 | 128 | 126 |
| /24 | 255.255.255.0 | 256 | 254 |
| /23 | 255.255.254.0 | 512 | 510 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
Why Subnetting Matters
Subnetting serves several critical purposes:
- Network segmentation — Divide a large network into smaller, manageable segments. This improves performance and security
- Efficient IP usage — Assign only as many addresses as needed instead of wasting large blocks
- Broadcast control — Smaller subnets mean smaller broadcast domains, reducing unnecessary network traffic
- Security isolation — Separate sensitive systems (databases, admin panels) onto their own subnets
- Routing efficiency — Routers can summarize routes, reducing the size of routing tables
Private IP Address Ranges
Certain IP ranges are reserved for private networks (not routable on the public internet). These are defined in RFC 1918:
| Range | CIDR | Subnet Mask | Common Use |
|---|---|---|---|
| 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 | 255.0.0.0 | Large enterprises, cloud VPCs |
| 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 | 255.240.0.0 | Medium-sized organizations |
| 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | 255.255.0.0 | Home and small office networks |
Your router uses NAT (Network Address Translation) to allow devices with private IPs to communicate on the public internet through a single public IP address. You can check your public IP at WheresThatIP.com.
Subnetting Example: Dividing a /24 Network
Suppose you have the network 192.168.1.0/24 (254 usable hosts) and you want to divide it into 4 equal subnets:
- A /24 has 8 host bits. To create 4 subnets, you need 2 more network bits (2^2 = 4), making each subnet a /26
- Each /26 subnet has 62 usable hosts
| Subnet | Network Address | Usable Range | Broadcast |
|---|---|---|---|
| 1 | 192.168.1.0/26 | 192.168.1.1 - 192.168.1.62 | 192.168.1.63 |
| 2 | 192.168.1.64/26 | 192.168.1.65 - 192.168.1.126 | 192.168.1.127 |
| 3 | 192.168.1.128/26 | 192.168.1.129 - 192.168.1.190 | 192.168.1.191 |
| 4 | 192.168.1.192/26 | 192.168.1.193 - 192.168.1.254 | 192.168.1.255 |
How to Find Your Subnet Mask
Windows
ipconfig
Look for "Subnet Mask" under your active network adapter.
Mac
ifconfig | grep netmask
Linux
ip addr show
The CIDR notation appears after the IP address (e.g., 192.168.1.100/24).
Subnet Masks and IP Lookup
When you look up a public IP address using our IP Lookup tool, the results often include the network range and CIDR notation. This tells you the size of the network block assigned to that organization. Our WHOIS tool provides even more detail about network allocations.
Frequently Asked Questions
What is the default subnet mask?
The most common default subnet mask is 255.255.255.0 (/24), which is used by most home routers. This allows up to 254 devices on the local network.
Does the subnet mask affect internet speed?
No. The subnet mask defines network boundaries, not bandwidth. However, a very large subnet can increase broadcast traffic, which could slow down the local network.
What is the difference between a subnet mask and a gateway?
The subnet mask defines which addresses are on your local network. The gateway (default gateway) is the IP address of the router that forwards traffic to other networks, including the internet.