IPv4 Subnet Calculator

IPv4 subnet calculation is a fundamental networking skill. Given an IP address and CIDR prefix (like 192.168.1.0/24), you can derive the network address, broadcast address, first and last usable host addresses, number of usable hosts, and the subnet mask in dotted-decimal notation. This calculator performs all these calculations instantly. Enter any valid IPv4 address followed by a slash and the prefix length (0-32). The prefix length determines how many bits are the network portion: /24 gives 254 hosts, /16 gives 65,534 hosts, /8 gives 16,777,214 hosts. The calculator uses bitwise operations on the 32-bit integer representation of the IP address.

Common subnet sizes

CIDRSubnet maskTotal IPsUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/30255.255.255.25242
/32255.255.255.25510 (single host)

Formula

Usable hosts = 2^(32 - prefix length) - 2

Network address = IP AND subnet mask

Broadcast address = Network address OR wildcard mask

IPv4 subnetting: frequently asked questions

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its associated subnet mask as a single string: the IP address followed by a slash and the prefix length. For example, 192.168.1.0/24 means the first 24 bits are the network portion and the remaining 8 bits are the host portion. The prefix length ranges from /0 (no fixed bits) to /32 (single host) for IPv4.

What is a subnet mask?

A subnet mask is a 32-bit number that separates the network portion of an IP address from the host portion. It is written in dotted-decimal notation (e.g., 255.255.255.0 for /24). Bits set to 1 identify the network; bits set to 0 identify the host. A /24 mask (255.255.255.0) gives 256 IP addresses in the subnet, with 254 usable host addresses.

How many usable hosts does a /24 subnet have?

A /24 subnet has 2^(32-24) = 2^8 = 256 total IP addresses. Two addresses are reserved: the network address (first IP) and the broadcast address (last IP). So usable host addresses = 256 - 2 = 254. The formula is: usable hosts = 2^(32 - prefix length) - 2.

What is the difference between the network address and broadcast address?

The network address is the first address in a subnet (all host bits set to 0) and is used to identify the subnet itself, not assigned to any host. The broadcast address is the last address in the subnet (all host bits set to 1) and is used to send data to all devices in the subnet simultaneously. Neither can be assigned to a host.

What are private IP address ranges?

RFC 1918 defines three private IPv4 address ranges that are not routed on the public internet: 10.0.0.0/8 (10.0.0.0 to 10.255.255.255), 172.16.0.0/12 (172.16.0.0 to 172.31.255.255), and 192.168.0.0/16 (192.168.0.0 to 192.168.255.255). These are used for home and office networks behind NAT (Network Address Translation) routers.

Official sources

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