What an IP subnet calculator does
Every IPv4 address has 32 bits. A subnet mask, or its shorter CIDR form such as /24, says how many of those bits identify the network and how many identify a device on it. The calculator applies the mask to your address to find where the network starts, where it ends and which addresses in between can be handed to devices.
The formulas
broadcast = network OR (NOT mask)
total addresses = 2(32 - prefix)
usable hosts = total - 2 (for prefixes up to /30)
The first address of a subnet is the network address and the last is the broadcast address. Neither can be assigned to a host, which is why a /24 holds 256 addresses but only 254 usable ones. The wildcard mask is the inverse of the subnet mask and is used in router access lists and OSPF configuration.
Worked example
Take 192.168.1.0 with a /24 prefix. The mask is 255.255.255.0, which is 11111111.11111111.11111111.00000000 in binary. The network address is 192.168.1.0, the broadcast address is 192.168.1.255 and the usable range is 192.168.1.1 to 192.168.1.254, a total of 254 hosts. The wildcard mask is 0.0.0.255.
Now take 10.1.2.77 with a /20 prefix. The mask is 255.255.240.0, so the third octet is cut into blocks of 16. The address sits in the block starting at 10.1.0.0, which runs to 10.1.15.255 and offers 4,094 usable hosts.
Common prefix sizes
| Prefix | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /24 | 255.255.255.0 | 256 | 254 |
| /26 | 255.255.255.192 | 64 | 62 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
Special cases: /31 and /32
A /32 identifies a single host, so there is no range to list. A /31 holds two addresses and is used on point-to-point links, where both addresses serve as hosts and no broadcast address is needed. In both cases the tool reports no usable range in the traditional sense.
Classful ranges and private space
Historically IPv4 was split into classes. Class A used the first octet 1 to 126, class B 128 to 191 and class C 192 to 223. Today networks use classless addressing, so the prefix length matters far more than the class. Three blocks are reserved for private networks and are not routed on the public internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The tool labels an address Private when it lies inside one of those blocks and Public otherwise.
All the subnets in a block
When your prefix does not land on a whole octet, the tool lists every network of that size inside the enclosing block. A /28 inside 10.1.2.x, for example, produces 16 networks of 16 addresses each, starting at 10.1.2.0, 10.1.2.16, 10.1.2.32 and so on. This is the quickest way to plan how to carve one network into equal parts.
IPv6
IPv6 addresses have 128 bits, written as eight groups of four hexadecimal digits. A prefix such as /64 fixes the first 64 bits as the network and leaves 64 bits for hosts, which is 18,446,744,073,709,551,616 addresses. IPv6 has no broadcast address and no need to subtract two, so every address in the prefix counts. Consecutive groups of zeros may be shortened to a single double colon, so 2001:0db8:0000:0000:0000:0000:0000:0001 is written 2001:db8::1. The calculator shows both the compressed and expanded forms.
Tips for planning
- Size each subnet for growth. A subnet that is full cannot be extended without renumbering.
- Keep subnet sizes to powers of two and align them on their own boundary.
- Reserve the first or last usable address for the gateway and document it.
- For IPv6, use /64 for ordinary LAN segments and /48 for sites.
Reading the extra fields
Besides the host range, the result lists several alternative forms of the same address. The binary ID and integer ID are the address written as a 32 bit string and as a single decimal number, which some databases and firewalls use to store addresses. The hex ID is the same value in hexadecimal. The in-addr.arpa entry is the name used for reverse DNS lookups, with the octets written backwards. The IPv4 mapped address and the 6to4 prefix show how the address would be written inside IPv6.