Examples
- 192.168.1.10/24: network 192.168.1.0, broadcast 192.168.1.255, mask 255.255.255.0, usable hosts 192.168.1.1–192.168.1.254 (254 hosts).
- 10.20.30.40/20: network 10.20.16.0, broadcast 10.20.31.255, mask 255.255.240.0, usable hosts 10.20.16.1–10.20.31.254 (4,094 hosts).
How subnetting works
An IPv4 address is 32 bits. The CIDR prefix (/24, /20…) says how many of those bits identify the network; the rest identify hosts. The network address has all host bits set to 0 and the broadcast address has them all set to 1, so a subnet has 2(32 − prefix) addresses and 2 fewer usable hosts. /31 point-to-point links and /32 single hosts are exceptions.
Common subnet sizes
| CIDR | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 |
| /32 | 255.255.255.255 | 1 | 1 |
Private address ranges (RFC 1918)
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
These can be used inside any private network and aren't routed on the public internet. 100.64.0.0/10 is reserved for carrier-grade NAT.
Worked example
IP address 192.168.1.10 with prefix /24 (mask 255.255.255.0): network address 192.168.1.0, broadcast 192.168.1.255, usable hosts 192.168.1.1 to 192.168.1.254 (254 hosts = 28 − 2). It's a private class C range (RFC 1918).
Frequently asked questions
What is a subnet mask?
A 32-bit number that marks which part of an IP address is the network and which part is the host. /24 is the same as 255.255.255.0.
How many hosts are in a /24?
256 addresses, of which 254 can be given to devices; the first is the network address and the last is the broadcast address.
What is a wildcard mask?
The inverse of the subnet mask (255.255.255.255 minus the mask). It's used in Cisco access lists and OSPF configuration, for example 0.0.0.255 for a /24.
Does this work for IPv6?
This calculator is for IPv4. IPv6 subnets are normally /64 for a single network, with 2⁶⁴ addresses.