What is a Subnet Mask? CIDR and Subnetting Explained
A subnet mask divides an IP address into a network portion and a host portion, defining which devices are on the same local network. Learn how subnet masks work, what CIDR notation means, and how to calculate network ranges.
The problem a subnet mask solves
An IPv4 address is 32 bits — just a number. By itself it does not tell you which part identifies the network and which part identifies the specific device on that network. A subnet mask answers that question.
When your computer wants to send data to another IP address, it first checks: is this address on my local network, or does it need to go to the router? The subnet mask is what it uses to make that decision.
How a subnet mask works
A subnet mask is also a 32-bit number. Every 1 bit in the mask corresponds to a network bit in the IP address; every 0 bit is a host bit.
CIDR notation — the shorthand
Writing 255.255.255.0 every time is verbose. CIDR (Classless Inter-Domain Routing) notation expresses the same thing as a suffix — the number of leading 1 bits in the mask.
The prefix length tells you how many hosts fit in the subnet: 2^(32 - prefix) - 2 usable hosts (subtract 2 for the network address and broadcast address).
Common subnet sizes
| CIDR | Subnet mask | Usable hosts | Typical use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Very large networks (Class A) |
| /16 | 255.255.0.0 | 65,534 | Large office / ISP blocks (Class B) |
| /24 | 255.255.255.0 | 254 | Typical home / small office LAN |
| /25 | 255.255.255.128 | 126 | Split a /24 into two halves |
| /28 | 255.255.255.240 | 14 | Small server segments |
| /30 | 255.255.255.252 | 2 | Point-to-point links |
| /32 | 255.255.255.255 | 1 | Single host / loopback route |
Private IP ranges
Three address ranges are reserved for private networks (RFC 1918) — they are never routed on the public internet:
- 10.0.0.0/8 — 10.x.x.x, ~16 million addresses
- 172.16.0.0/12 — 172.16.x.x to 172.31.x.x, ~1 million addresses
- 192.168.0.0/16 — 192.168.x.x, ~65,000 addresses (home networks)
Related guides
Calculate subnet ranges, broadcast addresses, and host counts
Enter any IP and CIDR prefix to get the full breakdown
Open Subnet Calculator →