Networking

IPv4 subnet calculator

Network, broadcast, usable host range, subnet mask and wildcard mask for any IPv4 address and prefix length.

Any address inside the subnet, for example 192.168.10.77.

Result

Network address
10.20.30.0/24
Usable host range
10.20.30.1 – 10.20.30.254
Broadcast address
10.20.30.255
Usable hosts
254
Total addresses
256
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Address type
Private (RFC 1918)

Formula

Mask = 32 − prefix ones followed by zeros. Network = address AND mask. Broadcast = network OR wildcard (the inverted mask). Usable hosts = 2^(32 − prefix) − 2.

Assumptions

  • Usable hosts subtract the network and broadcast addresses, except /31 (two usable, RFC 3021) and /32 (one host).
  • Address type is looked up in the IANA special-purpose registry; a public result does not mean the address is assigned to you.

Questions

Why does a /24 have 254 usable hosts and not 256?
A /24 holds 256 addresses. The first is the network address and the last is the broadcast address, so 254 are left for hosts.
What is a wildcard mask used for?
A wildcard mask is the inverse of the subnet mask. Cisco access lists and OSPF network statements use it to say which bits must match.
Can I use a /31 for a link between two routers?
Yes. RFC 3021 allows /31 subnets on point-to-point links, which saves two addresses per link.

Related tools