IPv4 Subnet Calculator

Calculate network ranges, subnet masks, broadcast addresses, and usable hosts for any IPv4 configuration.

Enter Network Details


Results

Network Address
—
Broadcast Address
—
Subnet Mask
—
Wildcard Mask
—
First Usable Host
—
Last Usable Host
—
Total Addresses
—
Usable Hosts
—
CIDR Notation
—
IP Class
—
Binary Breakdown (network bits in green, host bits in blue)
—

How It Works

An IPv4 address is a 32-bit number split into four 8-bit octets. The subnet mask determines how many bits belong to the network portion versus the host portion. Given a prefix length (CIDR), we compute the mask as all 1s for the first N bits and 0s for the remaining (32−N) bits. The network address is obtained by performing a bitwise AND of the IP and mask. The broadcast address sets all host bits to 1 (network OR inverse of mask). Usable host addresses span from network+1 to broadcast−1, giving 2(32−N) − 2 assignable addresses for subnets larger than /30.

Frequently Asked Questions

How do I calculate the number of usable hosts in a subnet?
To calculate usable hosts, use the formula 2^(32 − prefix length) − 2. For example, a /24 subnet gives you 2^8 = 256 total addresses minus 2 (network and broadcast) = 254 usable hosts. The subtraction of 2 accounts for the network address and broadcast address, which cannot be assigned to individual devices.
What is the difference between a subnet mask and CIDR notation?
A subnet mask is a 32-bit number expressed in dotted decimal format (e.g., 255.255.255.0) that identifies the network and host portions of an IP address. CIDR notation is a shorthand representation using a slash followed by the number of network bits (e.g., /24). Both represent the same information — /24 equals 255.255.255.0.
What is a subnet wildcard mask and why is it useful?
A wildcard mask is the inverse of a subnet mask. While a subnet mask has 1s for network bits and 0s for host bits, a wildcard mask flips this — 0s for network bits and 1s for host bits. For example, a /24 subnet mask of 255.255.255.0 has a wildcard mask of 0.0.0.255. Wildcard masks are commonly used in access control lists (ACLs) and routing protocols like OSPF.

Related Tools

Free tools by TUNA — energy supply from vetted manufacturers