Tech

How Subnetting Works (CIDR, Masks and Host Counts)

A subnet is a block of IP addresses set by a prefix length such as /24. A /24 has 2^(32 − 24) = 256 addresses and 254 usable hosts. For 192.168.1.10/24, the network is 192.168.1.0, the broadcast is 192.168.1.255 and the mask is 255.255.255.0.

By CalculatorHub Editorial TeamPublished December 2, 2026Updated December 2, 20266 min read
Run the numbers yourself. Try our free IP Subnet Calculator and see the result with your own figures.

IP addresses are 32 bits

An IPv4 address such as 192.168.1.10 is four numbers (octets) of 8 bits each. The prefix length says how many of the first bits identify the network; the rest identify the host.

The subnet mask

A /24 means 24 ones then 8 zeros: 255.255.255.0. A /26 is 255.255.255.192. A /20 is 255.255.240.0.

Network and broadcast

The network address is the IP AND the mask (all host bits zero). The broadcast address has all host bits set to one. For 192.168.1.130/26, the network is 192.168.1.128 and the broadcast is 192.168.1.191.

Counting hosts

Addresses = 2^(32 − prefix) Usable hosts = addresses − 2
PrefixAddressesUsable hosts
/24256254
/25128126
/266462
/273230
/281614
/2986
/3042

Splitting a network

Add 1 to the prefix to halve a network. A /24 splits into two /25 networks of 128 addresses each, then four /26 of 64, and so on. This is how you give each department or site its own subnet.

Private ranges

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are reserved for private networks.

Special cases

A /31 links two devices and a /32 is a single host. Check your design with the IP subnet calculator, and estimate transfer speeds with the bandwidth calculator.

Key terms

  • Prefix length: The number of network bits.
  • Octet: One of the four 8-bit parts of an IPv4 address.
  • Gateway: The router address that leads out of a subnet.
  • VLSM: Using different prefix lengths in one network.
  • Broadcast: An address that reaches every host in the subnet.

Practice questions

Try each one before you read the answer.

  1. How many usable hosts in a /27?
    Answer: 30.
  2. What is the mask for /28?
    Answer: 255.255.255.240.
  3. What subnet size do you need for 100 hosts?
    Answer: /25 (126 usable hosts).

A worked subnetting example

You have 192.168.10.0/24 and need four subnets for four offices. Four subnets need 2 extra bits (2² = 4), so the new prefix is /26. Each subnet has 64 addresses and 62 usable hosts.

SubnetNetworkUsable rangeBroadcast
1192.168.10.0.1 to .62192.168.10.63
2192.168.10.64.65 to .126192.168.10.127
3192.168.10.128.129 to .190192.168.10.191
4192.168.10.192.193 to .254192.168.10.255

Choosing the right size

Work out how many hosts you need, add some room to grow, and pick the smallest prefix that fits. For 50 hosts you need /26 (62 usable). For 100 hosts you need /25 (126). Do not make subnets much larger than needed, because it wastes addresses.

Common mistakes

  • Giving a device the network or broadcast address.
  • Overlapping subnets, which causes routing problems.
  • Forgetting the router (gateway) takes one address.

Why subnet at all?

Splitting a network keeps traffic local, makes it easier to apply security rules between groups, limits how far a problem can spread and uses addresses efficiently. A home network is usually a single /24, while a company may have many subnets for staff, servers, guests and cameras.

Practise with small examples until splitting by powers of two feels natural.

Frequently asked questions

Why subtract 2 from the host count?

The first address is the network and the last is the broadcast, so neither can be given to a device.

What is CIDR notation?

An address followed by a slash and the prefix length, such as 10.0.0.0/8.

How many hosts are in a /30?

2 usable hosts, often used for links between two routers.

Try the calculators

Keep reading