HOME / COMPUTER SCIENCE & DATA / NETWORKING / IP SUBNET CALCULATOR
Computer Science & Data / Networking

IP Subnet Calculator

CIDR (10.0.0.5/16) or address then mask (10.0.0.5 255.255.0.0)

Try an example

Subnet

192.168.1.0/24

Usable host range
192.168.1.1 – 192.168.1.254
Usable hosts
254
Broadcast address
192.168.1.255
Total addresses
256
Subnet mask
255.255.255.0
Wildcard (inverse) mask
0.0.0.255
Address type
Private (RFC 1918): not routed on the public internet
Legacy class
Class C (classful addressing is obsolete; the prefix decides the subnet)

In binary

Address11000000.10101000.00000001.00001010
Mask11111111.11111111.11111111.00000000
Network11000000.10101000.00000001.00000000
Broadcast11000000.10101000.00000001.11111111

Bold bits are the network part (the first 24); the rest identify a host. The network address has every host bit 0, the broadcast address every host bit 1.

Divide into smaller subnets

Calculate an IPv4 subnet from an address with a CIDR prefix or a subnet mask: the network and broadcast addresses, the usable host range and count, the mask and wildcard mask, the address type, the bits in binary, and how the network divides into smaller subnets.

Formula

Addresses=232−prefix\text{Addresses} = 2^{32 - \text{prefix}}
Usable hosts=232−prefix−2\text{Usable hosts} = 2^{32 - \text{prefix}} - 2
Network=address AND mask\text{Network} = \text{address AND mask}
Broadcast=network OR wildcard\text{Broadcast} = \text{network OR wildcard}

Worked Example

Address192.168.1.10/24
Result
Network192.168.1.0
Usable hosts192.168.1.1 – 192.168.1.254 (254)
Broadcast192.168.1.255
Mask255.255.255.0
Wildcard0.0.0.255

A /24 prefix leaves 8 host bits, so the subnet has 2⁸ = 256 addresses. The first (all host bits 0) names the network and the last (all 1) is the broadcast address, leaving 254 for devices.

Frequently Asked Questions

What does /24 mean in an IP address?

It is the prefix length: the first 24 bits are the network part and the remaining 8 identify hosts. /24 is the same as the mask 255.255.255.0; /16 is 255.255.0.0 and /8 is 255.0.0.0.

Why are two addresses in every subnet unusable?

The address with all host bits 0 identifies the network itself and the one with all host bits 1 is the broadcast address. The exceptions are /31, used for point-to-point links where both addresses are usable (RFC 3021), and /32, a single host.

Which IP addresses are private?

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918). They are free for anyone to use inside a network and are not routed on the public internet; a router translates them to a public address with NAT.

Common Mistakes

  • !Using the network or broadcast address for a device.
  • !Confusing the subnet mask with the wildcard mask used in router access lists: 255.255.255.0 corresponds to the wildcard 0.0.0.255.