Subnet Calculator
Calculate network address, broadcast address, usable host range, and number of hosts from an IP address and CIDR prefix.
Subnet math.
Broadcast = Network OR NOT(mask)
Usable hosts = 2^(32-prefix) − 2
The Fundamentals of IPv4 Subnetting
Subnetting is the practice of dividing a large physical IP network into smaller, logical subnetworks (subnets). In network administration, subnetting is essential for optimizing IP address allocation, improving network routing efficiency, isolating network segments for security, and reducing broadcast traffic. A Subnet Calculator processes IP addresses and CIDR subnet masks, outputting critical network metrics instantly.
CIDR Notation and Bitwise Netmasks
IPv4 addresses are 32-bit binaries divided into four 8-bit octets (e.g., 192.168.1.1). CIDR (Classless Inter-Domain Routing) notation designates the network prefix length using a slash, such as /24. The /24 indicates that the first 24 bits represent the network portion, and the remaining 8 bits represent host devices. The calculator performs bitwise AND operations between the IP and the mask to identify the subnet's network address, broadcast address, and host ranges.
Calculating Usable Host Addresses
For any subnet, the number of total host addresses is 2^(32 - prefix). However, the first address (network address) and the last address (broadcast address) are reserved and cannot be assigned to hosts. Therefore, the number of usable host IPs is 2^(32 - prefix) - 2. For a /24 subnet, this gives 256 - 2 = 254 usable hosts. Subnet calculators help network engineers plan address spaces (such as Class A, B, and C private blocks) without manual binary conversions.
Frequently Asked Questions
A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting divides a large network into smaller, manageable segments, improving security (containing breaches), performance (reducing broadcast traffic), and organization (assigning address blocks by department or location). It is fundamental to enterprise network design and routing.
CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its subnet mask as a combined prefix, e.g., 192.168.1.0/24. The number after the slash (/24) is the prefix length — it tells you how many bits of the 32-bit IP address are the network portion. /24 means 24 network bits and 8 host bits, giving 256 total addresses (254 usable hosts).
Usable hosts = 2^(host bits) − 2. The subtraction accounts for the network address (first IP) and broadcast address (last IP), which cannot be assigned to devices. For a /24 subnet (8 host bits): 2⁸ − 2 = 254 usable hosts. For a /28 (4 host bits): 2⁴ − 2 = 14 usable hosts.
The network address is the first IP in a subnet (all host bits = 0) and identifies the subnet itself — it cannot be assigned to a device. The broadcast address is the last IP (all host bits = 1) and is used to send packets to all devices on the subnet simultaneously. For 192.168.1.0/24: network = 192.168.1.0, broadcast = 192.168.1.255.
RFC 1918 defines three private (non-routable) IP ranges reserved for internal networks: 10.0.0.0/8 (10.0.0.0 – 10.255.255.255), 172.16.0.0/12 (172.16.0.0 – 172.31.255.255), and 192.168.0.0/16 (192.168.0.0 – 192.168.255.255). These addresses are not accessible from the public internet without NAT (Network Address Translation).