Subnet calculator: work out any IPv4 network in seconds
Enter an IP address with a CIDR prefix or subnet mask to get the network and broadcast addresses, usable host range, wildcard mask and more.
What is subnetting and CIDR notation?
An IPv4 address has two parts: a network portion that identifies the subnet, and a host portion that identifies a device inside it. The subnet mask says where the split falls. CIDR notation is a shorthand for the same thing: 192.168.1.0/24 means "the first 24 bits are the network", which is identical to the mask 255.255.255.0.
The smaller the number after the slash, the bigger the network. A /24 holds 256 addresses, a /16 holds 65,536, and a /8 holds more than 16 million.
How the numbers are worked out
- Network address: the IP address with all host bits set to 0 (the IP AND the mask).
- Broadcast address: the same address with all host bits set to 1.
- Usable hosts: total addresses minus 2, because the network and broadcast addresses cannot be assigned to devices. Special cases: a /31 has two usable addresses for point-to-point links (RFC 3021) and a /32 is a single host.
- Wildcard mask: the inverse of the subnet mask, used in router access lists and OSPF.
CIDR prefix lengths at a glance
| CIDR | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /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 and special IPv4 ranges
These blocks are not routed on the public internet. Knowing them helps you tell whether an address belongs to your own network or is your public IP.
| Range | Purpose |
|---|---|
| 10.0.0.0/8 | Private network (RFC 1918), about 16.7 million addresses |
| 172.16.0.0/12 | Private network (RFC 1918), 172.16.0.0 to 172.31.255.255 |
| 192.168.0.0/16 | Private network (RFC 1918), the default for most home routers |
| 100.64.0.0/10 | Carrier-grade NAT, used by ISPs that share one public IP between many customers |
| 169.254.0.0/16 | Link-local; a device assigns itself one of these when DHCP fails |
| 127.0.0.0/8 | Loopback, the device talking to itself (127.0.0.1 is "localhost") |
| 224.0.0.0/4 | Multicast |
Frequently asked questions
How many hosts are in a /24?
A /24 has 256 addresses in total and 254 usable host addresses, since the first (network) and last (broadcast) addresses are reserved. A /24 is the same as the mask 255.255.255.0.
How do I calculate a subnet?
Enter an IP address and a prefix such as 192.168.1.10/24, or an address followed by a mask such as 192.168.1.10 255.255.255.0. The calculator returns the network and broadcast addresses, the usable host range, the number of hosts and both masks.
What is a wildcard mask?
It is the subnet mask with every bit flipped. For 255.255.255.0 the wildcard mask is 0.0.0.255. Cisco access lists and OSPF network statements use wildcard masks instead of subnet masks.
Why are two addresses unusable in every subnet?
The lowest address identifies the network itself and the highest is the broadcast address used to reach every host in the subnet. Neither can be assigned to a device. The exceptions are /31 networks (point-to-point links) and /32 (a single host).
What is the difference between CIDR and a subnet mask?
They describe the same thing in two notations. CIDR counts the network bits (/24); the subnet mask writes the same bits in dotted decimal (255.255.255.0). CIDR also removed the old class A, B and C boundaries, so networks can be any size.
Does this support IPv6?
This calculator is for IPv4. IPv6 networks are almost always assigned as /64 for a single LAN, so there is rarely any need to calculate host ranges by hand.