IPv4 Calculator
Calculate network address, broadcast address, host range and subnet mask for any IPv4 address.
Inputs
Network Address
192.168.1.0
Subnet Mask
255.255.255.0
Broadcast Address
192.168.1.255
First Usable Host
192.168.1.1
Last Usable Host
192.168.1.254
Total Usable Hosts
254
Step by step
Parse IP address
192.168.1.100
= 3232235876
Decimal integer: 3232235876
Compute subnet mask
/24
= 255.255.255.0
24 bits set to 1
Compute network address
192.168.1.100 AND 255.255.255.0
= 192.168.1.0
Compute broadcast address
192.168.1.0 OR NOT(255.255.255.0)
= 192.168.1.255
Calculate usable hosts
2^(32-24) - 2
= 254
How it works
An IPv4 address combined with a prefix length defines a subnet. The network address is found by ANDing the IP with the subnet mask, the broadcast address by ORing the network address with the inverted mask. Usable host addresses fall between these two endpoints, excluding the network and broadcast addresses themselves.
Formulas
Network address
network = IP AND mask
- IP
- IPv4 address as 32-bit integer
- M
- Subnet mask (prefix 1s followed by 0s)
Usable hosts
hosts = 2^(32 - prefix) - 2
- p
- CIDR prefix length
Frequently Asked Questions
What is a CIDR prefix length?
The CIDR prefix length (e.g. /24) specifies how many leading bits of the 32-bit address are the network portion. A /24 means the first 24 bits identify the network and the remaining 8 bits identify hosts within it, giving 254 usable host addresses.
Why are two addresses subtracted for usable hosts?
The first address in the range is the network address (used to identify the subnet itself) and the last is the broadcast address (used to reach all hosts on the subnet simultaneously) — neither can be assigned to a host device.