Calculating a subnet means determining the network address, the broadcast address, and the number of available hosts from an IP address and a mask. Here is the method explained simply, with a free calculator to do it instantly.
Subnet, Mask, and CIDR: The Basics
An IPv4 address consists of a network part and a host part. The subnet mask indicates where the separation lies. In CIDR notation, it is written with a slash followed by the number of network bits (e.g., /24 = 255.255.255.0).
How to Calculate a Subnet
From an IP and a CIDR:
- The network address is obtained by applying the mask to the IP address (binary AND operation).
- The broadcast address corresponds to the last address of the block.
- The number of usable hosts is 2^(32 − CIDR) − 2 (subtracting the network address and the broadcast address).
Example for 192.168.1.10/24: network 192.168.1.0, broadcast 192.168.1.255, and 254 usable hosts (from .1 to .254).
Table of Common CIDR Masks
| CIDR | Mask | Usable Hosts |
|---|---|---|
| /30 | 255.255.255.252 | 2 |
| /29 | 255.255.255.248 | 6 |
| /28 | 255.255.255.240 | 14 |
| /27 | 255.255.255.224 | 30 |
| /26 | 255.255.255.192 | 62 |
| /25 | 255.255.255.128 | 126 |
| /24 | 255.255.255.0 | 254 |
Calculate Automatically (Free Calculator)
To get all these results without manual calculation, use our free subnet calculator: enter an IP and a CIDR, and it instantly displays the network address, broadcast, usable range, mask, and number of hosts.
Subnets and VLANs
Splitting a network into subnets often goes hand in hand with creating VLANs on a manageable switch, to isolate traffic (office, telephony, video surveillance). See our VLAN guide.
FAQ
What is a subnet for?
To segment a network into smaller blocks, improving security, limiting broadcast, and organizing addressing.
Why are 2 addresses subtracted?
The network address (the first) and the broadcast address (the last) cannot be assigned to devices.
What is the /24 mask?
It is the 255.255.255.0 mask, which allows 254 usable hosts: the most common in local networks.
To build your network, browse our network switches and our enterprise routers.
