IPv4 subnet calculator
Network, mask, broadcast, usable range and host count of an IPv4 subnet, from an address and a CIDR prefix.
Result
Awaiting the quantities required for the calculation.
Calculation, assumptions and sources
OverviewAn IPv4 address and a prefix (CIDR like /24, or a decimal mask like 255.255.255.0) give the network address, the mask and wildcard mask, the broadcast address, the first and last usable address, the number of addresses and usable hosts, and the address type (private, public, loopback, link-local, multicast, reserved).
An IPv4 address and a prefix (CIDR like /24, or a decimal mask like 255.255.255.0) give the network address, the mask and wildcard mask, the broadcast address, the first and last usable address, the number of addresses and usable hosts, and the address type (private, public, loopback, link-local, multicast, reserved).
Method & formulasnetwork = address AND mask
The prefix (e.g. /24) gives the number of high-order bits reserved for the network; the remaining bits identify hosts. Mask, broadcast and usable range follow from the address and the prefix.
- CIDR
- the "address/prefix" notation (e.g. 192.168.1.0/24) that replaced classes A/B/C in 1993 (RFC 1519).
- Wildcard mask
- the complement of the mask, used in Cisco access control lists (ACLs).
- Broadcast address
- the last address in the range, which reaches every host in the subnet.
- /31 (RFC 3021)
- point-to-point links: both addresses are usable, with no reserved network or broadcast.
- /32
- a prefix designating a single address (a route or a single host).
Validity domainThe A/B/C/D/E class is shown for historical information only.
The A/B/C/D/E class is shown for historical information only. A non-contiguous decimal mask (e.g. 255.255.0.255) corresponds to no prefix and is rejected.
Example192.168.1.42/24: mask 255.255.255.0, network 192.168.1.0, broadcast 192.168.1.255, usable range from 192.168.1.1 to 192.168.1.254 (254 hosts), private address (RFC 1918).
192.168.1.42/24: mask 255.255.255.0, network 192.168.1.0, broadcast 192.168.1.255, usable range from 192.168.1.1 to 192.168.1.254 (254 hosts), private address (RFC 1918).