CIDR & Subnet Calculator
Work out the network, host range, masks and address type of an IPv4 or IPv6 block, split it into subnets, and check whether an address belongs to it.
Divide into subnets
| # | Subnet | Usable host range | Broadcast |
|---|
Pin tools here. They are saved in this browser.
Pin a tool and its sticker lands here.
Work out the network, host range, masks and address type of an IPv4 or IPv6 block, split it into subnets, and check whether an address belongs to it.
| # | Subnet | Usable host range | Broadcast |
|---|
CIDR notation writes a block of addresses as an address and a prefix length, such as 192.168.1.0/24. The prefix length is the number of leading bits that every address in the block shares. The remaining bits number the hosts, so a /24 in IPv4 leaves 8 host bits and holds 256 addresses, and each bit added to the prefix halves the block.
A netmask says the same thing in dotted form: 24 one bits followed by 8 zero bits is 255.255.255.0. A wildcard mask is its inverse, 0.0.0.255, and is the form that Cisco IOS access lists and OSPF network statements expect. You can type any of the three and the tool converts between them.
In IPv4 the first address of a subnet names the network and the last one is the broadcast address, so a subnet has two usable hosts fewer than it has addresses. There are two exceptions. A /31 has only two addresses, and RFC 3021 lets a point-to-point link use both as hosts, with no broadcast address. A /32 is a single host, as used for loopback interfaces and host routes.
IPv6 has no broadcast address, because multicast does that job, so the tool counts every address of an IPv6 block. The first address of an IPv6 subnet is the Subnet-Router anycast address (RFC 4291), which routers answer on. A normal IPv6 subnet is a /64, because stateless address autoconfiguration needs a 64-bit interface identifier.
Some ranges have a fixed purpose. RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks, and 100.64.0.0/10 is the range providers use for carrier-grade NAT. 127.0.0.0/8 is loopback and 169.254.0.0/16 is link-local. In IPv6, fc00::/7 holds the unique local addresses and fe80::/10 the link-local ones. 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32 exist only for documentation, which is why examples use them.
The classes A, B and C fixed the network size from the first bits of the address until CIDR replaced them in 1993. The tool shows the class for reference only: routing no longer uses it.
The address is turned into one integer of 32 bits for IPv4 or 128 bits for IPv6, and the results come from bitwise operations on that integer and the mask. IPv6 addresses are written in the canonical form of RFC 5952: lower case, no leading zeros, and the longest run of zero groups replaced by ::. In the binary row, the vertical bar marks where the network bits end and the host bits begin.
A /24 holds 256 addresses. In IPv4 the first is the network address and the last is the broadcast address, which leaves 254 usable hosts.
A netmask has 1 bits for the network part and 0 bits for the host part, for example 255.255.255.0. A wildcard mask is the same value inverted, 0.0.0.255, where a 1 bit means that the bit may vary. Cisco IOS access lists and OSPF network statements take wildcard masks, while interface addresses are normally written with a netmask or a prefix length.
A /31 has only two addresses. RFC 3021 allows both to be used as hosts on a point-to-point link, where a broadcast address is not needed, so no address is spent on the network or broadcast role.
Each bit you add to the prefix divides the block in two. A /24 becomes two /25, four /26 or eight /27 subnets. Because the split is by bits, the number of equal subnets is always a power of two; if you ask for five, the tool gives you eight.
No. The calculation is done by JavaScript in your browser tab. The tool makes no network request, so what you type stays on your device.
It opens in its own window and keeps working offline.
To install it, tap the Share button, then “Add to Home Screen”.