Guide

Subnetting explained: CIDR, masks and host counts

Reviewed 22 November 2026 · 6 min read · Written and maintained by Toolnexo

Subnetting has a reputation for being harder than it is. An IPv4 address is a 32-bit number, a subnet is a block of consecutive addresses, and CIDR notation simply says how many leading bits identify the block. This guide builds up from there (masks, host counts, splitting a network and private ranges) using worked examples you can check with the subnet calculator on this site, which runs entirely in your browser.

What the slash number means

In 192.168.1.0/24 the /24 means the first 24 of the address's 32 bits are the network part, and the remaining 8 bits identify hosts within it. The same thing written as a mask is 255.255.255.0: 24 one-bits followed by 8 zero-bits. A /16 is 255.255.0.0 and a /8 is 255.0.0.0.

The number of addresses in a block is 2 raised to the number of host bits: a /24 has 2^8 = 256 addresses, a /26 has 2^6 = 64, a /30 has 4.

Network, broadcast and usable hosts

In an ordinary subnet the first address (all host bits zero) is the network address and the last (all host bits one) is the broadcast address. Neither can be assigned to a device, so the usable hosts are 2^host-bits − 2. A /24 therefore has 254 usable hosts: 192.168.1.1 to 192.168.1.254, with 192.168.1.0 as the network and 192.168.1.255 as the broadcast.

Two prefix lengths are special. A /32 is a single host. A /31 has two addresses and, under RFC 3021, both are usable, which is how point-to-point links save addresses.

Finding the network from any address

Given 192.168.1.10/24, apply the mask with a bitwise AND: the host bits become zero and the network is 192.168.1.0. For a less tidy example, 10.1.2.3/20 has a mask of 255.255.240.0, so the network is 10.1.0.0, the broadcast is 10.1.15.255 and there are 4,094 usable hosts. The wildcard mask (the inverse of the mask, 0.0.15.255 here) is what some router and firewall rules use.

Splitting a network

To split 192.168.0.0/24 into four equal subnets, lengthen the prefix by two bits to /26. You get 192.168.0.0, 192.168.0.64, 192.168.0.128 and 192.168.0.192, each with 64 addresses and 62 usable hosts. The rule is simple: each extra bit of prefix doubles the number of subnets and halves the size of each.

Private ranges and special addresses

  • 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are private ranges for use inside networks (RFC 1918).
  • 127.0.0.0/8 is loopback: traffic to your own machine.
  • 169.254.0.0/16 is link-local, assigned automatically when no DHCP answer arrives.
  • 100.64.0.0/10 is shared address space used by carrier-grade NAT.
  • 224.0.0.0/4 is multicast.

Common mistakes

  • Forgetting that two addresses are reserved when counting hosts.
  • Choosing a subnet too small to leave room for growth.
  • Overlapping subnets when you split manually.
  • Using a non-contiguous mask, which is not valid.
Tools in this guide

Put it into practice

How this guide is maintained

This page is reviewed when the related tools change. It describes what the published tools actually do: the tools run in your browser tab, so your files stay on your device. If you find something inaccurate, email [email protected] and it will be corrected.

Keep reading

Other guides

All guides →