What it does
This calculator takes an IPv4 address and CIDR prefix (the /n notation) and breaks down the entire subnet into its component parts: the network address, broadcast address, subnet mask, and the range of usable host addresses. It's essential for network planning, device configuration, and understanding IP allocation.
The mechanics
Every IPv4 address is 32 bits. The CIDR prefix tells you how many of those bits identify the network, and the rest identify individual hosts within that network.
For example, /24 means the first 24 bits are the network portion, leaving 8 bits for hosts. /16 means 16 bits for the network and 16 for hosts.
The calculator:
- Converts the IP address to binary
- Applies the CIDR mask to isolate the network portion
- Calculates the network address (host bits set to 0)
- Calculates the broadcast address (host bits set to 1)
- Derives the subnet mask in dotted-decimal notation
- Determines the first and last usable host addresses
- Counts total hosts and usable hosts (excluding network and broadcast)
The formula
Network Address = IP AND (Subnet Mask) | Broadcast Address = Network Address OR (Inverted Subnet Mask) | Usable Hosts = 2^(32 - CIDR) - 2
Worked example
Let's subnet 192.168.1.100 with a /24 prefix.
Step 1: Convert to binary and apply mask
- 192.168.1.100 in binary:
11000000.10101000.00000001.01100100 - /24 mask: first 24 bits are network, last 8 are hosts
Step 2: Network address
- Set all host bits (the last 8) to 0
- Result:
11000000.10101000.00000001.00000000= 192.168.1.0
Step 3: Subnet mask
- 24 network bits =
11111111.11111111.11111111.00000000 - In dotted decimal: 255.255.255.0
Step 4: Broadcast address
- Set all host bits to 1
- Result:
11000000.10101000.00000001.11111111= 192.168.1.255
Step 5: Usable host range
- First usable: 192.168.1.1 (network + 1)
- Last usable: 192.168.1.254 (broadcast − 1)
- Total addresses: 2^8 = 256
- Usable hosts: 256 − 2 = 254 hosts
Summary:
- Network: 192.168.1.0
- Subnet Mask: 255.255.255.0
- Broadcast: 192.168.1.255
- Usable Range: 192.168.1.1 – 192.168.1.254
- Host Count: 254
Common mistakes
Forgetting to exclude network and broadcast addresses. The network address (all host bits = 0) and broadcast address (all host bits = 1) cannot be assigned to devices. Always subtract 2 from the total number of addresses to get usable hosts.
Confusing CIDR with subnet mask. /24 and 255.255.255.0 describe the same thing, but CIDR is the shorthand. A /30 subnet (used for point-to-point links) has a mask of 255.255.255.252 and only 2 usable hosts.
Misreading the host bits. With a /16 network, you have 16 host bits, meaning 2^16 = 65,536 total addresses and 65,534 usable hosts. Larger prefixes (like /28) mean fewer hosts; smaller prefixes mean more.
Not validating the IP format. Ensure each octet is 0–255 and the CIDR prefix is 0–32. Invalid input will produce incorrect results.
When planning your network, always account for growth. A /24 with 254 usable hosts might seem plenty, but it fills quickly in production environments. Document your subnetting scheme so future administrators understand your allocation strategy.