Overview

Subnetting divides an IP network into smaller parts. Network engineers constantly need the network address, mask, broadcast and usable range.

Enter an IPv4 address and CIDR prefix.

Worked examples

InputsResult
IP octet 1192IP octet 2168IP octet 31IP octet 434CIDR prefix (/0–/32)24Network: 192.168.1.0/24Subnet mask: 255.255.255.0Broadcast: 192.168.1.255Usable hosts: 192.168.1.1 to 192.168.1.254 (254)Total addresses: 256Wildcard mask: 0.0.0.255
Show 2 more examples
IP octet 1172IP octet 216IP octet 35IP octet 49CIDR prefix (/0–/32)16Network: 172.16.0.0/16Subnet mask: 255.255.0.0Broadcast: 172.16.255.255Usable hosts: 172.16.0.1 to 172.16.255.254 (65,534)Total addresses: 65,536Wildcard mask: 0.0.255.255
IP octet 110IP octet 20IP octet 30IP octet 41CIDR prefix (/0–/32)30Network: 10.0.0.0/30Subnet mask: 255.255.255.252Broadcast: 10.0.0.3Usable hosts: 10.0.0.1 to 10.0.0.2 (2)Total addresses: 4Wildcard mask: 0.0.0.3

How it works

The prefix defines the mask: its first p bits are 1. ANDing the IP with the mask gives the network; setting all host bits gives the broadcast. Usable hosts are 2^(32 − p) − 2, except for /31 and /32.

The formula

Network = IP AND mask · Hosts = 2^(32 − prefix) − 2
prefixNumber of network bits (CIDR)

Practical tips

  • 192.168.1.34/24 is in network 192.168.1.0 with 254 usable hosts.
  • 10.20.30.40/19 belongs to 10.20.0.0/19 with 8,190 usable hosts.
  • /31 is used for point-to-point links (RFC 3021) and /32 for a single host.

Frequently asked questions

How many hosts does /24 have?

254 usable out of 256 addresses.

What is a wildcard mask?

The inverse of the subnet mask, used in some router access lists.