Subnet Calculator (IPv4 / CIDR)
Work out any IPv4 subnet from an address and prefix length. Get the subnet mask, network and broadcast addresses, the usable host range and how many hosts the subnet holds.
How to use this calculator
- Enter any IP address within the subnet.
- Enter the CIDR prefix — the /n after the address (/24, /16, etc.).
- Press Calculate for the mask, network, broadcast, host range and counts.
Formula used
The /n prefix is how many leading bits are the network portion; the rest address hosts. Two addresses are reserved per subnet — the network address (all host bits 0) and broadcast (all host bits 1) — so usable hosts are 2^(32−n) − 2. (/31 and /32 are special-cased for point-to-point links.)
Example calculation
192.168.1.100/24: mask 255.255.255.0, network 192.168.1.0, broadcast 192.168.1.255.
Usable range 192.168.1.1–192.168.1.254 = 254 hosts (256 total minus network and broadcast). A /24 is the classic home-router subnet.
How subnetting works
An IPv4 address is 32 bits, split into a network part and a host part. The CIDR prefix (/24 means 24 network bits) draws that line — the higher the prefix, the smaller the subnet: /24 gives 254 usable hosts, /30 gives just 2 (perfect for router-to-router links), /16 gives 65,534.
The reserved pair trips up beginners: every subnet loses its first address (the network identifier) and its last (the broadcast address that reaches all hosts at once), which is why usable count is always two below the total. Subnetting exists to carve large address blocks into right-sized, isolated networks for security and efficient routing.
Why use this calculator?
- Plan networks and VLANs without manual binary arithmetic.
- Find the usable host range and broadcast address for firewall and DHCP config.
- Translate CIDR prefixes to subnet masks and host counts instantly.
Frequently asked questions
How many hosts are in a /24?
254 usable (256 total addresses minus the network and broadcast addresses). A /24 uses a 255.255.255.0 mask — the most common size for small LANs and home networks.
What does the /number in an IP mean?
It's the CIDR prefix — how many of the 32 bits belong to the network. /24 means 24 network bits and 8 host bits (256 addresses). Bigger prefix = smaller subnet; smaller prefix = larger subnet.
Why can't I use the first and last addresses?
The first (all host bits 0) identifies the network itself; the last (all host bits 1) is the broadcast address that reaches every host simultaneously. Both are reserved, so a subnet's usable hosts are always its total minus 2 — except /31 and /32, which have special point-to-point rules.