IP Subnet Calculator

Calculate subnet details from any IPv4 CIDR block: network, broadcast, netmask, host range.

IP Subnet Calculator

IP subnetting divides a network into smaller logical segments. Each subnet is defined by a network address and a CIDR prefix length (e.g., /24), which determines how many bits are used for the network portion versus the host portion.

This tool computes the network address, broadcast address, subnet mask, wildcard mask, usable host range, and total number of hosts for any IPv4 CIDR block. Essential for network planning, firewall rules, and infrastructure design.

How it works

Subnet mask = 32 - CIDR prefix bits set to 1. Network = IP AND mask. Broadcast = network OR NOT(mask). Usable hosts = 2^(32 - CIDR) - 2 (for CIDR < 31).

Use cases

  • Planning network segmentation for offices or data centers
  • Configuring firewall rules and access control lists
  • Allocating IP address ranges for DHCP pools
  • Troubleshooting connectivity and routing issues

Frequently asked questions

How many usable hosts are in a /24 subnet?

A /24 subnet has 8 host bits, giving 2^8 = 256 total addresses, of which 254 are usable. Two addresses are reserved: the network address (all host bits zero) and the broadcast address (all host bits one). For example, 192.168.1.0/24 offers usable hosts from 192.168.1.1 to 192.168.1.254.

What does CIDR notation like /24 actually mean?

The number after the slash is the count of bits used for the network portion of the address, out of the 32 bits in an IPv4 address. A /24 means the first 24 bits identify the network, leaving 8 bits for hosts, which corresponds to the subnet mask 255.255.255.0. Higher prefixes mean smaller subnets: each additional bit halves the number of available host addresses.

How do I calculate the network and broadcast addresses?

The network address is the bitwise AND of the IP address and the subnet mask, which zeroes out all host bits. The broadcast address is the network address with all host bits set to one, computed as network OR NOT(mask). Everything strictly between those two addresses is the usable host range.

Why do /31 and /32 subnets not follow the usable-hosts formula?

The formula 2^(32−CIDR) − 2 assumes separate network and broadcast addresses, which only applies for prefixes up to /30. A /31 has just 2 addresses and, per RFC 3021, both are usable on point-to-point links. A /32 is a single address, commonly used to reference one specific host in routing tables and firewall rules.

What is a wildcard mask and where is it used?

A wildcard mask is the bitwise inverse of the subnet mask: 255.255.255.0 becomes 0.0.0.255. Zeros mark bits that must match and ones mark bits that can vary. It is mainly used in Cisco access control lists and OSPF configuration instead of a regular subnet mask.

Related Calculators