How to use the subnet calculator
- Enter an IPv4 address such as
192.168.1.10. You can also type the prefix with it, like10.0.0.5/8. - Enter the prefix length (0 to 32) or a dotted subnet mask such as
255.255.255.0. The mask must be contiguous: all 1 bits on the left, all 0 bits on the right. - Optionally enter how many subnets you want, to split the network into equal parts.
- Press Calculate. The key figures appear in the result card, and the binary view and subnet list appear below.
Everything is calculated in your browser.
How it works
An IPv4 address is a 32-bit number, written as four bytes in decimal. The prefix length says how many bits from the left belong to the network; the remaining bits number the hosts inside it.
- Network address = address AND mask (all host bits set to 0)
- Broadcast address = network OR wildcard mask (all host bits set to 1)
- Wildcard mask = the mask with every bit inverted
- Total addresses = 2 to the power of (32 − prefix)
- Usable hosts = total addresses − 2, because the network and broadcast addresses cannot be given to a device
Worked example
For 192.168.1.10/24 the mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. The network address is 192.168.1.0 and the broadcast address is 192.168.1.255. That leaves 256 addresses, of which 254 are usable: 192.168.1.1 to 192.168.1.254. It is a private address from the RFC 1918 range.
A less round example: 172.16.5.77/20 belongs to the network 172.16.0.0, whose broadcast address is 172.16.15.255, with 4,094 usable hosts.
Splitting a network
Splitting borrows bits from the host part. Asking for 3 subnets of 192.168.1.0/24 borrows 2 bits, because 2 bits give 4 equal subnets: /26 networks starting at .0, .64, .128 and .192, each with 62 usable hosts. The number of subnets is always rounded up to a power of 2.
Special cases
- /31: under RFC 3021 both addresses can be used on a point-to-point link, so there are 2 usable hosts and no broadcast address.
- /32: a single address, used for host routes and loopback interfaces.
- Private ranges (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) are for local networks and are not routed on the internet. The tool also recognizes loopback, link-local, carrier-grade NAT, documentation, multicast and reserved ranges. - Address classes (A to E) are shown for reference only. Modern networks use classless addressing (CIDR).