Toolbit

Subnet Calculator

Calculate network, broadcast, host range and mask from an IP and CIDR prefix.

What is a subnet?

An IPv4 network is a contiguous range of addresses that share the same "network" bits. The CIDR prefix (e.g. /24) tells you how many of the 32 bits in an IP address are reserved to identify the network, leaving the rest to identify individual hosts within it.

Splitting a large network into smaller subnets lets you organize addressing by building, floor, department, or function, shrink broadcast domains, and apply security policy per segment. The trade-off is straightforward: the more bits you take from the host portion and give to the network, the fewer host addresses are left in each subnet — but you gain more independent subnets.

Every standard subnet (from /1 to /30) has three well-defined parts:

  • Network address: the first address in the range, with all host bits set to zero. It identifies the subnet itself, not a host.
  • Broadcast address: the last address in the range, with all host bits set to one. Used to send traffic to every host in the subnet at once.
  • Usable host range: every address between the network and broadcast addresses, excluding both. These are the ones you can assign to devices.

The subnet mask (e.g. 255.255.255.0 for a /24) is the dotted-decimal representation of those network bits. The wildcard mask is its binary complement, mostly used in Cisco access-list configuration.

Full CIDR table (/8 to /30)

PrefixMaskUsable hostsTotal addresses
/8255.0.0.016,777,21416,777,216
/16255.255.0.065,53465,536
/20255.255.240.04,0944,096
/22255.255.252.01,0221,024
/24255.255.255.0254256
/25255.255.255.128126128
/26255.255.255.1926264
/27255.255.255.2243032
/28255.255.255.2401416
/29255.255.255.24868
/30255.255.255.25224

The general rule: each additional prefix bit halves the number of available addresses. And the number of usable hosts is always 2^(32-prefix) - 2, since you subtract the network and broadcast addresses from the total.

The special cases: /31 and /32

That "minus 2" rule stops applying for the two smallest prefixes, which is a common source of confusion.

/31 — point-to-point links (RFC 3021). With only 2 addresses available in the subnet, reserving one for the network and one for broadcast would leave zero usable hosts. RFC 3021 fixed this for the specific case of point-to-point links (e.g., between two routers): both addresses are treated as usable hosts, and there is no separate broadcast address. This is the de facto standard today for serial WAN links or router-to-router interconnects, since it doubles addressing efficiency in a scenario that only ever has two endpoints anyway.

/32 — single host. A /32 prefix doesn't describe a subnet in the traditional sense — it describes a single IP address. There are no host bits, so there's no separate concept of network, broadcast, or range: the one available address serves all three roles at once. It's typically used for very specific static routes, router loopback configurations, or firewall rules targeting an exact host.

How to use this calculator

Enter an IP address and pick a CIDR prefix between /1 and /32 (you can also paste something like 192.168.1.10/24 directly into the IP field). The calculation updates instantly, no button required, and the state is reflected in the URL so you can share or bookmark a specific calculation.

Beyond the network, broadcast, and host range, the calculator automatically classifies the address type (private under RFC 1918, public, loopback, link-local, or multicast) and shows the full binary representation of the IP, clearly marking where the network portion ends and the host portion begins based on the chosen prefix.