How to use this calculator
- Enter or choose iPv4 address.
- Enter or choose prefix length (CIDR).
- The network (CIDR) updates as you type. Use Copy result or Share to keep it.
Method
Block size = 2^(32 − prefix); Network = ⌊address ÷ block⌋ × block; Broadcast = Network + block − 1; Usable hosts = block − 2 (2 for /31, 1 for /32)
- prefix
- number of network bits (0–32)
- block
- number of addresses in the subnet
Worked example
- A /24 leaves 32 − 24 = 8 host bits, so the block is 2⁸ = 256 addresses.
- The network address keeps the first three octets and sets the last to 0: 192.168.1.0.
- The broadcast address sets all host bits to 1: 192.168.1.255.
- Usable hosts are 256 − 2 = 254, from 192.168.1.1 to 192.168.1.254.
192.168.1.10/24 is in network 192.168.1.0/24, with 254 usable addresses from .1 to .254 and mask 255.255.255.0.
What the result means
Devices on the same subnet talk directly; anything outside goes through a router. Pick the smallest subnet that leaves room to grow: a /26 holds 62 hosts, a /25 126 and a /24 254.
Assumptions and limits
- IPv4 only.
- The network and broadcast addresses are not assigned to hosts, except in /31 point-to-point links (RFC 3021) and single-host /32 routes.
- IPv6 subnets are not calculated.
- Address type labels cover the main special ranges (private, loopback, link-local, CGNAT, multicast), not every reserved block.
Questions
What is a wildcard mask?
The inverse of the subnet mask (0.0.0.255 for /24). Cisco access lists and OSPF use it to say which bits may vary.
Why are two addresses not usable?
In a normal subnet the all-zeros host address names the network itself and the all-ones address is the broadcast address.