IPv4 Calculator
Find the network, broadcast, mask and hosts of any IPv4 address, and watch the math happen on the ground, bit by bit.
- Usable hosts
- of
- Type
network hosts Tap a row of the result and the ground lights up that address; tap a light to flip that bit of the IP.
See the math step by step1 / 7
An IPv4 address is 32 lights
The address is four numbers from 0 to 255, the octets. Each octet holds 8 bits, and each bit is a light on the ground: lit means 1, dark means 0. One row per octet, 32 bits in total.
2 / 7
Each octet is a sum
The weights painted on the asphalt double from right to left: 1, 2, 4, 8 up to 128. Add up the weights of the lights that are on in a row and you get its number.
3 / 7
The mask splits network from hosts
means the first bits belong to the network. Lit in a row, they form the mask . The cable marks the border: the network before it, the host bits after it.
4 / 7
Network address: turn the hosts off
Keep the network bits as they are in the IP and turn every host bit off. That is the AND operation between the IP and the mask, and the result is the network address: .
5 / 7
Broadcast: turn every host on
Keep the network the same and turn every host bit on. The result is the broadcast, : a message sent to it reaches every device on the network.
With /31 and /32 there is no broadcast: there are too few host bits to set one address aside for it.
6 / 7
The addresses for your devices
Between the network and the broadcast are the addresses you can give to devices, from the first, , to the last, . With host bits there are 2 to the power of addresses, minus the network and the broadcast: hosts.
With /31 both addresses are usable, on a link between two routers (RFC 3021). With /32 the block is a single address: .
7 / 7
Wildcard: the mask inside out
Swap every 1 in the mask for 0 and every 0 for 1 and you get the wildcard, . Routers and firewalls use it in access lists to say which bits may vary.