How IPv4 subnetting works
An IPv4 address has 32 bits, written as four 8-bit blocks called octets. The number after the slash, the prefix length, says how many of those bits identify the network. The rest identify individual devices.
In 192.168.1.0/24, 24 bits belong to the network and 8 bits are left for hosts. That gives 2⁸ = 256 addresses. The first is the network address, and the last is the broadcast address, so 254 can be assigned to devices.
The formula is: usable hosts = 2^(32 − prefix) − 2
CIDR quick reference
Worked example: 192.168.10.77/26
A /26 uses blocks of 64 addresses. The address ends in .77, which falls between .64 and .127, so:
Special cases: /31 and /32
A /31 has only two addresses. Under RFC 3021 both can be used on point-to-point links between two devices, with no network or broadcast address. A /32 is a single address, often used for a specific host route or loopback.
How to choose the right subnet size
Start with the number of devices you have today. Then allow for growth and for the things that are easy to forget, such as printers, IP phones, cameras and WiFi access points. If you need 50 devices, a /26 (62 usable) fits on day one but leaves little room. A /25 (126 usable) is the safer choice.
Typical business layouts
Many organisations give each function its own subnet or VLAN, for example staff computers, guest WiFi, servers, VoIP phones, CCTV and network management. Private ranges for this are defined in RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. When you connect offices by VPN, make sure their ranges do not overlap, as that is a common cause of routing problems. Some cloud platforms also reserve extra addresses in each subnet, so check your provider’s documentation.
Common subnetting mistakes
Frequently asked questions