How to calculate a subnet range
A practical guide to calculating network address, broadcast address, and usable host range from an IP address and subnet size.
What you need to start
To calculate a subnet range, you need an IPv4 address and either a CIDR prefix (such as /24) or a subnet mask (such as 255.255.255.0).
Once you know the subnet boundary, you can determine the network address, broadcast address, and usable host range.
What values you calculate
- Network address
- Broadcast address
- First usable host
- Last usable host
- Total number of addresses
- Number of usable hosts
Step-by-step method
The process for calculating a subnet range follows a consistent pattern:
- Identify the subnet size (CIDR or mask)
- Determine the block size
- Find the network boundary
- Calculate the broadcast address
- Determine usable host range
Worked example
Given the IP address 192.168.1.50/24:
CIDR: /24
Subnet mask: 255.255.255.0
Network: 192.168.1.0
Broadcast: 192.168.1.255
Usable: 192.168.1.1 - 192.168.1.254
Total IPs: 256
Usable IPs: 254A /24 means the last octet is used for hosts, giving a block size of 256 addresses.
Smaller subnet example
Now consider a smaller subnet: 192.168.1.50/27
CIDR: /27
Subnet mask: 255.255.255.224
Block size: 32
Network: 192.168.1.32
Broadcast: 192.168.1.63
Usable: 192.168.1.33 - 192.168.1.62
Total IPs: 32
Usable IPs: 30The key step is identifying the block size and finding which range the IP falls into.
How to calculate block size
Block size is calculated by subtracting the subnet mask value from 256 in the relevant octet.
Mask: 255.255.255.224
256 - 224 = 32
Block size = 32Common mistakes
- Forgetting to exclude network and broadcast addresses
- Using the wrong octet when calculating block size
- Assuming all subnets are /24
- Mixing CIDR and subnet mask incorrectly
Why this matters
Subnet calculations are used in VLAN design, firewall rules, routing decisions, and cloud networking.
Being able to quickly calculate ranges is a core networking skill for troubleshooting and planning.
Use a subnet calculator
Instead of calculating manually, you can use DNS Pro to instantly generate subnet ranges: https://app.dnspro.co.uk
You can enter an IP with CIDR, or an IP with subnet mask, and get the full range immediately.
Related concepts
If you are new to subnetting, start here: /articles/what-is-a-subnet-mask
To understand CIDR notation in more detail: /articles/what-is-cidr-notation
