What Is a Subnet?
A subnet is a slice of a network, defined by its mask. Subnet masks, CIDR notation and how to work out the network, broadcast and host range, with an example.
What Is Subnetting?
Subnetting splits one big network into smaller ones called subnets. Each subnet is its own segment, which keeps traffic tidy, lets you set different rules per segment and makes addresses easier to manage. An office building split into departments: each has its own floor, but it is still one building.
Understanding Subnet Masks
A subnet mask says which part of an IP address names the network and which part names the host. It is 32 bits, same as an IPv4 address. 255.255.255.0 in binary is 11111111.11111111.11111111.00000000: the 1s are the network portion, the 0s the host portion. Apply it to 192.168.1.100 and you get:
- Network address:
192.168.1.0(the first 24 bits) - Host portion:
.100(the last 8 bits)
| Subnet Mask | CIDR | Binary | Usable Hosts |
|---|---|---|---|
255.0.0.0 | /8 | 11111111.00000000.00000000.00000000 | 16,777,214 |
255.255.0.0 | /16 | 11111111.11111111.00000000.00000000 | 65,534 |
255.255.255.0 | /24 | 11111111.11111111.11111111.00000000 | 254 |
255.255.255.128 | /25 | 11111111.11111111.11111111.10000000 | 126 |
255.255.255.192 | /26 | 11111111.11111111.11111111.11000000 | 62 |
255.255.255.240 | /28 | 11111111.11111111.11111111.11110000 | 14 |
CIDR Notation
CIDR (Classless Inter-Domain Routing) notation writes address and mask together: a slash and the number of network bits instead of the full mask. 192.168.1.0/24 means network 192.168.1.0 with mask 255.255.255.0. The number after the slash is the prefix length, how many of the 32 bits belong to the network; the rest is for hosts.
Calculating Network, Broadcast, and Host Range
Take 192.168.1.100/24:
- Subnet mask: /24 =
255.255.255.0 - Network address: a bitwise AND of the IP and the mask gives
192.168.1.0 - Broadcast address: all host bits set to 1 gives
192.168.1.255 - First usable host: network address + 1 =
192.168.1.1 - Last usable host: broadcast address - 1 =
192.168.1.254 - Total usable hosts: 28 - 2 = 254
The general formula is 2(32 - prefix) - 2. The 2 you subtract are the network and broadcast addresses, which no device can use.
Practical Subnetting Example
You have 10.0.0.0/24 (254 hosts) and want four equal subnets:
| Subnet | Network Address | Host Range | Broadcast | Usable Hosts |
|---|---|---|---|---|
| 1 | 10.0.0.0/26 | 10.0.0.1 - 10.0.0.62 | 10.0.0.63 | 62 |
| 2 | 10.0.0.64/26 | 10.0.0.65 - 10.0.0.126 | 10.0.0.127 | 62 |
| 3 | 10.0.0.128/26 | 10.0.0.129 - 10.0.0.190 | 10.0.0.191 | 62 |
| 4 | 10.0.0.192/26 | 10.0.0.193 - 10.0.0.254 | 10.0.0.255 | 62 |
Going from /24 to /26 borrows 2 bits from the host portion: 22 = 4 subnets, each with 26 - 2 = 62 usable addresses. Our Subnet Calculator does this for any CIDR block, no binary math needed.
Try it on a real address. Free, no account needed.