IP Subnet Calculator

Subnetting splits an IPv4 network into smaller blocks, and the math is exact bitwise arithmetic defined by the IETF. Enter an IPv4 address and a CIDR prefix, and this calculator derives the subnet mask, the network and broadcast addresses, the usable host range, and the number of usable hosts. It handles the /31 and /32 special cases too. Because the result comes straight from the standard rather than any estimate, you can use it to plan address allocation or verify a configuration.

0.00
0.00
0.00
0.00
0.00
0.00

Subnet formula

Host bits = 32 - prefix
Total addresses = 2 ^ host bits
Subnet mask = leading prefix bits set to 1
Network address = IP bitwise AND mask
Broadcast address = network OR (NOT mask)
Usable hosts = total addresses - 2 (for prefix ≤ /30)

The network and broadcast addresses come from masking the IP. Usable hosts exclude those two reserved addresses. A /31 has 2 usable addresses (point-to-point), and a /32 is a single host.

Subnetting context

  • CIDR notation writes the prefix length after a slash, such as /24.
  • The subnet mask marks network bits with 1 and host bits with 0.
  • The network and broadcast addresses are reserved and not assignable to hosts.
  • A /31 is used for point-to-point links and a /32 for a single host route.
  • IPv4 and CIDR are defined by IETF standards.

IP subnet: frequently asked questions

How does a CIDR prefix define a subnet?

The CIDR prefix is the number of leading bits in the 32-bit IPv4 address that identify the network. A /24, for example, fixes the first 24 bits as the network and leaves 8 bits for hosts. The subnet mask has those leading bits set to 1 and the rest to 0.

How many usable hosts are in a subnet?

A subnet has 2 raised to the number of host bits total addresses. Two are reserved: the network address (all host bits 0) and the broadcast address (all host bits 1). So usable hosts equal 2 to the host bits, minus 2, for prefixes up to /30. A /31 and /32 are special cases.

What are the network and broadcast addresses?

The network address is the lowest address in the subnet, with all host bits set to 0. The broadcast address is the highest, with all host bits set to 1. The usable host range lies between them, from network plus one to broadcast minus one.

What does the subnet mask look like?

The subnet mask is the 32-bit value with the leading prefix bits set to 1 and the rest 0, written in dotted-decimal form. A /24 mask is 255.255.255.0, and a /26 mask is 255.255.255.192. The calculator derives it from the prefix you enter.

Is this calculation exact and standards-based?

Yes. CIDR and IPv4 addressing are defined by IETF RFCs, and the subnet arithmetic is exact bitwise operations on the 32-bit address. There are no estimates; the results follow directly from the standard.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.