Subnet Calculator

Calculate network, broadcast, usable host range, subnet mask, and wildcard mask for IPv4 CIDR.

IP / CIDR
Subnet Mask
Wildcard Mask
Network Address
Broadcast Address
Usable Host Range
Total Hosts
Usable Hosts
Show binary view
IP:
Mask:
Network:
Broadcast:

Subnetting basics (IPv4)

Subnetting splits a larger IP network into smaller segments (subnets) so you can organize hosts, contain broadcasts, and apply routing or security policies per segment. In CIDR notation (e.g., 192.168.1.10/24), the prefix length (/24) tells you how many of the first bits are the network portion. The rest are for host addresses inside that subnet.

How this calculator works

Given IP and /prefix:

mask        = first  bits set to 1 (32-bit)
wildcard    = bitwise NOT of mask
network     = IP AND mask
broadcast   = network OR wildcard
total hosts = 2^(32 - prefix)
usable      = (prefix <= 30) ? (total - 2) : 0
host range  = (prefix <= 30) ? [network+1 ... broadcast-1] : N/A
      

Note on /31 and /32: in “classic” accounting, there are no usable hosts because network/broadcast take the edges. In practice, /31 is commonly used on point-to-point links (RFC 3021) where both addresses are assigned and no broadcast exists; /32 represents a single host route.

Quick examples

Example 1: 192.168.1.10/24

Example 2: 10.12.34.56/20

Private IPv4 ranges (for LANs)

FYI: 169.254.0.0/16 is link-local (APIPA)—assigned automatically when DHCP fails; not routed.

Common CIDR cheat sheet

PrefixSubnet maskTotalUsable*
/32255.255.255.25510
/31255.255.255.25420†
/30255.255.255.25242
/29255.255.255.24886
/28255.255.255.2401614
/27255.255.255.2243230
/26255.255.255.1926462
/25255.255.255.128128126
/24255.255.255.0256254
/23255.255.254.0512510
/22255.255.252.01,0241,022
/21255.255.248.02,0482,046
/20255.255.240.04,0964,094
/19255.255.224.08,1928,190
/18255.255.192.016,38416,382
/17255.255.128.032,76832,766
/16255.255.0.065,53665,534
/12255.240.0.01,048,5761,048,574
/8255.0.0.016,777,21616,777,214

*Usable excludes network & broadcast in classic IPv4 subnets.

†Many devices allow /31 on point-to-point links; both addresses are assignable.