How to Calculate a Subnet Range Step by Step
A practical guide to calculating network address, broadcast address, and usable host range from an IP address and subnet size.
Tools For This Topic
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 = 32A quick mental shortcut
When working in the last octet, list the block boundaries and find where the IP fits. For a /27, the ranges begin at 0, 32, 64, 96, 128, 160, 192, and 224. An address like 192.168.1.50 falls into the 32 to 63 block, so 192.168.1.32 is the network and 192.168.1.63 is the broadcast.
That shortcut saves time because you do not need to recalculate everything from scratch for every address. You just need the mask, the block size, and the correct boundary.
Common mistakes
- Forgetting to exclude network and broadcast addresses in traditional IPv4 subnets
- Using the wrong octet when calculating block size
- Assuming all subnets are /24
- Mixing CIDR and subnet mask incorrectly
- Applying the usual host-range rule to /31 or /32 without checking the intended design
A note on /31 and /32 ranges
Most everyday subnet calculations assume a network address, a broadcast address, and a remaining usable host range. That model works well for common IPv4 LAN sizes such as /24, /27, or /30.
Very small prefixes such as /31 and /32 are special cases, so treat them separately instead of forcing them into the normal subtract-two mental shortcut.
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 the DNS Pro Subnet Calculator to generate subnet ranges instantly.
You can enter an IP with CIDR, or an IP with subnet mask, and get the full range immediately.
Related concepts
Use These DNS Pro Tools
If you want to validate this topic in practice, these DNS Pro tools are the fastest next step.
Related Tools
Related Articles
What Is a Subnet Mask? Explained Clearly
Learn what a subnet mask does, how it separates network and host portions of an IPv4 address, and how it relates to CIDR and usable ranges.
CIDR Cheat Sheet for Common Subnet Sizes
Use this CIDR cheat sheet to quickly compare common subnet sizes, masks, block sizes, and usable host counts during subnet planning and troubleshooting.
Private vs Public IP Addresses Explained
Learn the difference between private and public IP addresses, how special-use ranges fit in, and why correct IP classification matters in troubleshooting.
