IP Subnet Calculator

Enter an IPv4 address and a CIDR prefix length to get the subnet mask, network and broadcast addresses, the usable host range, and the number of usable hosts.

/
Enter an IP and prefix, then press Calculate subnet.

How subnetting works

An IPv4 address is 32 bits, written as four 8-bit octets. A CIDR prefix like /24 says how many leading bits are the network portion; the rest identify hosts. The subnet mask is those network bits set to 1:

/24 255.255.255.0 · hosts = 2(32−prefix) 2

The network address is the IP with all host bits set to 0; the broadcast address has all host bits set to 1. The two reserved addresses (network and broadcast) are why usable hosts is 2(32−prefix) − 2.

Worked example

192.168.1.10 / 24:

Mask: /24 = 255.255.255.0.
Network: 192.168.1.0; Broadcast: 192.168.1.255.
Usable hosts: 28 − 2 = 254 (.1 to .254).

Reading the result

The host range is every address between the network and broadcast addresses — those are the IPs you can assign to devices. A smaller prefix (say /16) means a larger network with more hosts; a larger prefix (say /30) means a tiny subnet, useful for point-to-point links. A /31 and /32 are special cases with no usable-host subtraction in modern usage.

Tip: private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are reserved for internal networks and aren't routed on the public internet.

Frequently asked questions

How many hosts are in a subnet?

Usable hosts = 2^(32 − prefix) − 2. A /24 has 2^8 − 2 = 254 usable hosts; a /16 has 65,534. The minus two accounts for the network and broadcast addresses.

What is a CIDR prefix?

The number after the slash (like /24) tells how many leading bits of the 32-bit IPv4 address are the network portion. The remaining bits address hosts within that network.

What are the network and broadcast addresses?

The network address has all host bits set to 0 (192.168.1.0 for a /24); the broadcast address has all host bits set to 1 (192.168.1.255). Neither is assigned to a device.

What does the subnet mask mean?

The mask marks which bits are network (1s) and which are host (0s). A /24 mask is 255.255.255.0. Devices use it to decide whether another address is on the same local network.

MB
Mustafa Bilgic · Editor, Calcool
CIDR and subnetting follow IETF standards (RFC 4632). For the addressing reference see CIDR. Calculations run in your browser using bitwise integer math.

Related calculators