How to calculate a subnet
- Enter an IPv4 address with a prefix, such as
10.20.30.40/22, or with a dotted subnet mask, such as10.20.30.40 255.255.252.0. You can also choose the prefix from the list. - The network address, broadcast address, usable host range, subnet and wildcard masks, address class and type (private, public, loopback and so on) are shown instantly, along with binary, hex and reverse-DNS forms.
- Use Split into subnets to divide the network into smaller equal blocks, for example a /16 into /24s for VLANs or cloud subnets.
- Use the tester to check whether an address belongs to the network, which is handy for firewall rules and allow-lists.
CIDR and subnet masks explained
An IPv4 address is 32 bits. The prefix length in CIDR notation says how many of those bits identify the network; the rest identify hosts. A /24 leaves 8 host bits, so it has 256 addresses. The first is the network address and the last is the broadcast address, leaving 254 usable hosts. Each step down in prefix length doubles the size: /23 has 512 addresses, /22 has 1,024.
The subnet mask is the same idea written as an address: /24 is 255.255.255.0. The wildcard mask is its inverse (0.0.0.255) and is used by Cisco ACLs and OSPF. A /31 is a special case for point-to-point links with two usable addresses, and a /32 means a single host.
Cloud providers reserve extra addresses: AWS keeps 5 addresses in every subnet and Azure also keeps 5, so plan a little larger than the raw host count suggests.
How many hosts are in a /24?
256 addresses and 254 usable hosts, because the network and broadcast addresses cannot be assigned to devices.
Which IP ranges are private?
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918). They are not routed on the internet and are used inside homes, offices and cloud VPCs.
Does this support IPv6?
This calculator handles IPv4. IPv6 subnets are normally a fixed /64 per network, so the arithmetic is rarely needed.