Subnet Calculator

How to use the subnet calculator

  1. Type an IPv4 address. You can paste CIDR notation such as 10.0.5.77/22 and the prefix is picked up automatically.
  2. Choose a CIDR prefix or type a subnet mask. The two stay in sync, so typing 255.255.252.0 selects /22.
  3. Read the network, broadcast, first and last usable host, host count, wildcard mask, class and address type. The binary view highlights the network bits.
  4. Optionally pick a longer prefix under Split into subnets to list every smaller network inside the block. This is handy for VLAN or VPC planning.

CIDR notation explained

An IPv4 address is 32 bits, written as four 8-bit octets. Classless Inter-Domain Routing (CIDR) adds a slash and a prefix length, such as /24. That number says how many leading bits belong to the network. The remaining 32 − prefix bits number the hosts inside it. The subnet mask is the same idea written as an address, with the prefix bits set to 1 and the host bits set to 0.

Network = IP AND mask Broadcast = Network OR wildcard (wildcard = NOT mask) Addresses = 2^(32 − prefix) Usable = 2^(32 − prefix) − 2 (/31 → 2, /32 → 1)

Worked example: 10.0.5.77/22

A /22 mask is 22 ones: 11111111.11111111.11111100.00000000 = 255.255.252.0, so the wildcard is 0.0.3.255. The third octet 5 is 00000101. Keeping its top six bits gives 00000100 = 4, so the network is 10.0.4.0. Setting the ten host bits to 1 gives the broadcast 10.0.7.255. The usable range is 10.0.4.1 – 10.0.7.254, which is 210 − 2 = 1,022 hosts. 10.0.0.0/8 is RFC 1918 space, so the address is private.

Splitting a network

Each bit you add to the prefix doubles the number of subnets and halves their size. A /24 split into /26 networks gives 4 subnets of 64 addresses: 192.168.1.0, .64, .128 and .192. Each has 62 usable hosts. To size a subnet, find the smallest power of two that is at least hosts + 2. For 50 hosts that is 64 addresses, which means a /26.

Subnet cheat sheet (/8 to /32)

CIDRSubnet maskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (RFC 3021)
/32255.255.255.2550.0.0.011

Special IPv4 ranges

BlockPurpose
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private networks (RFC 1918). Not routed on the public internet
100.64.0.0/10Carrier-grade NAT shared address space (RFC 6598)
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local / APIPA, used when DHCP fails
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation and examples (RFC 5737)
224.0.0.0/4Multicast (old Class D)
240.0.0.0/4Reserved (old Class E), including 255.255.255.255 broadcast

Tips

Sources

Subnet Calculator by AllOnlineCalcs