An IP address has two parts: the network part, shared by every device on the same network, and the host part, which identifies one device. The subnet mask — or its short form, the CIDR prefix — says where one part ends and the other begins.
Subnet mask vs CIDR
These two lines say exactly the same thing:
192.168.1.10with subnet mask255.255.255.0192.168.1.10/24
An IPv4 address is 32 bits. /24 means the first 24 bits are the network and the remaining 8 bits are for hosts. In the mask, each network bit is a 1, so 24 ones followed by 8 zeros is 255.255.255.0.
How many addresses does a subnet hold?
The number of addresses is 2 to the power of the host bits. Two of them are reserved in a normal IPv4 subnet: the network address (all host bits 0) and the broadcast address (all host bits 1).
For 192.168.1.0/24: 8 host bits → 256 addresses → 254 usable hosts, from 192.168.1.1 to 192.168.1.254. The network address is 192.168.1.0 and the broadcast address is 192.168.1.255.
IPv4 cheat sheet
| CIDR | Subnet mask | Addresses | Usable hosts | Typical use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | The whole 10.0.0.0 private range |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large company or campus |
| /22 | 255.255.252.0 | 1,024 | 1,022 | Office floor, guest Wi-Fi |
| /24 | 255.255.255.0 | 256 | 254 | Home network |
| /25 | 255.255.255.128 | 128 | 126 | Half a /24 |
| /28 | 255.255.255.240 | 16 | 14 | Small block of public IPs |
| /30 | 255.255.255.252 | 4 | 2 | Link between two routers |
| /31 | 255.255.255.254 | 2 | 2 | Point-to-point link (RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1 | A single host |
Our subnet calculator works out the range, broadcast address and host count for any prefix, including uneven ones like /27.
Are two devices on the same network?
Apply the mask to both addresses. With a /24, 192.168.1.20 and 192.168.1.200 share 192.168.1 — same network, they can talk directly. 192.168.2.20 is on another network and needs a router. This is why a printer set to the wrong subnet "disappears" from your computer.
IPv6 prefixes
IPv6 uses the same CIDR notation, with 128-bit addresses:
- /64 — the standard size for one network (LAN). Devices pick their own addresses inside it.
- /56 or /48 — what providers typically give a home or business, enough for 256 or 65,536 separate /64 networks.
- /128 — a single address.
There is no broadcast address in IPv6, and nobody counts hosts in a /64 — it holds 18 quintillion addresses. See IPv4 vs IPv6 for the other differences.
Private ranges and their prefixes
The three private IPv4 ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, and CGNAT uses 100.64.0.0/10. More in public vs private IP addresses.