IP Subnet Calculator
Enter an IP address and a prefix or subnet mask to get the network and broadcast addresses, usable host range and more.
How to use the IP Subnet Calculator
- Pick what you want to work out using the tabs: IPv4 subnet, Split a network or IPv6.
- Enter IP address (You can also type a prefix or mask after a slash, e.g. 10.0.0.5/16 or 10.0.0.5/255.255.0.0).
- Choose Subnet mask / CIDR.
- Read your answer in the results panel. It updates as you type, and the breakdown, step-by-step working and any charts or tables appear below it.
- Use Share link to save or send the exact calculation, or Copy to paste the results elsewhere.
How subnetting works
An IPv4 address is a 32-bit number, usually written as four decimal octets such as 192.168.1.10. The subnet mask, or prefix length, says how many of those bits identify the network. The rest identify a host on that network. In CIDR notation, /24 means the first 24 bits are the network part, which is the same as the mask 255.255.255.0.
The calculator works on the binary form of the address:
- Network address = address AND mask (host bits set to 0)
- Broadcast address = network OR wildcard (host bits set to 1)
- Wildcard mask = the inverse of the subnet mask, used in Cisco ACLs and OSPF
- Usable hosts = 232 − prefix − 2
hosts = 2(32 − n) − 2
Two addresses are taken out because the network and broadcast addresses can’t be assigned to devices. There are two exceptions. A /31 has two usable addresses for point-to-point links (RFC 3021), and a /32 identifies a single host.
Worked example
Take 10.20.30.40/13. A /13 mask is 255.248.0.0, so only the second octet is split. 20 in binary is 00010100, and the mask octet 248 is 11111000. ANDing them gives 00010000, which is 16. The network is 10.16.0.0. The host part covers 19 bits, so the block runs to 10.23.255.255, with 219 − 2 = 524,286 usable hosts.
Common prefix sizes
| Prefix | Mask | Usable hosts |
|---|---|---|
| /30 | 255.255.255.252 | 2 |
| /29 | 255.255.255.248 | 6 |
| /28 | 255.255.255.240 | 14 |
| /27 | 255.255.255.224 | 30 |
| /26 | 255.255.255.192 | 62 |
| /24 | 255.255.255.0 | 254 |
| /16 | 255.255.0.0 | 65,534 |
Splitting a network
The Split a network tab lists every smaller subnet inside a larger block. Each extra prefix bit doubles the number of subnets and halves their size, so a /22 holds four /24s or sixteen /26s. This is handy for planning VLANs or cloud VPC subnets.
IPv6
IPv6 addresses are 128 bits long, written as eight groups of four hex digits. Leading zeros in a group can be dropped, and one run of all-zero groups can be replaced with ::. The calculator shows the full and compressed forms (following RFC 5952), the network prefix, the first and last address, and the exact number of addresses. A standard LAN uses a /64, which holds about 18.4 quintillion addresses.
Tips
- Private ranges (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) are not routed on the public internet.
- Leading zeros such as 010.1.1.1 are rejected, because some systems read them as octal.
- Cloud providers often reserve extra addresses in each subnet. AWS, for example, keeps five.
Frequently asked questions
How many hosts are in a /24 subnet?
A /24 has 256 addresses. Two are the network and broadcast addresses, which leaves 254 usable hosts.
What is a wildcard mask?
It is the subnet mask with every bit flipped. For 255.255.255.0 it is 0.0.0.255. Routers use it in access lists and OSPF to show which bits must match.
How do I find the network address from an IP and mask?
Write both in binary and AND them bit by bit. Each mask octet of 255 keeps the address octet, 0 clears it, and anything in between keeps only the masked bits.
Why is my 172.20.x.x address private?
The private block 172.16.0.0/12 covers 172.16.0.0 to 172.31.255.255, so any address with a second octet from 16 to 31 is private.
How many /64 subnets are in an IPv6 /48?
2 to the power of (64 − 48) = 65,536 subnets of /64.