Subnet Calculator
Netmask, usable hosts, and IP range from address and CIDR.
What it does
Classless addressing splits each IPv4 address into network and host parts at the CIDR boundary. The netmask marks the split with one bits, the first address names the network, the last broadcasts, and everything between serves hosts.
The tool above takes an address with its prefix length. It returns the netmask, usable host count, and the usable range with network and broadcast named in the note.
Each host bit doubles capacity minus the two reserved ends. A /24 holds 254 hosts, a /25 holds 126, and a /16 holds 65,534, which is why small offices live at /24 and campuses at /16.
The /31 and /32 edge cases follow point to point rules with no broadcast address, so this page covers /8 through /30 where classic subnetting applies.
How to use
- Enter the IPv4 address in four octets.
- Enter the CIDR prefix from 8 to 30.
- Read netmask, host count, and usable range.
- Assign router and servers from the usable ends.
Formula
- AND / OR
- Bitwise ops splitting network from host part.
- 2^(host bits)
- Addresses in the block before reservations.
- minus 2
- Network and broadcast addresses stay unusable.
Binary math underlies it all: 192 is 11000000 and the mask 255.255.255.0 is twenty four ones. Hex dumps of routers show the same bits.
Worked example
Example: 192.168.1.0/24
Classic home network address and prefix.
- Mask: 24 ones is 255.255.255.0.
- Network: 192.168.1.0 AND mask = 192.168.1.0.
- Broadcast: network OR 0.0.0.255 = 192.168.1.255.
- Hosts: 2^8 - 2 = 254, from 192.168.1.1 to 192.168.1.254.
Reference table
| CIDR | Netmask | Usable hosts |
|---|---|---|
| /30 | 255.255.255.252 | 2 |
| (/31 point to point) | (255.255.255.254) | (2, special rules) |
| /24 | 255.255.255.0 | 254 |
| /16 | 255.255.0.0 | 65,534 |
| /8 | 255.0.0.0 | 16,777,214 |
Limits
- IPv4 only. IPv6 subnets work differently.
- /8 to /30 modeled. /31 and /32 need special rules.
- Reserved and multicast ranges still compute blindly.
- VLSM planning needs per subnet passes.
Common mistakes
- Counting network and broadcast as usable.
- Reading /24 as 24 hosts instead of 254.
- Mixing netmask octet order.
- Forgetting the gateway needs a usable address too.
- Overlapping subnets across VLANs.
Try it yourself
Quick checks. Answers sit tucked under each question.
Hosts in a /26?
2^6 - 2 = 62 usable hosts.
Netmask of /16?
Sixteen ones: 255.255.0.0.
Questions
What does /24 mean?
Twenty four network bits: 254 usable hosts from .1 to .254.
Why minus two hosts?
Network address names the block and broadcast reaches all. Neither hosts a device.
What is a netmask?
Ones over network bits, zeros over host bits: /24 is 255.255.255.0.
Can subnets overlap?
Never on one router without NAT tricks. Plan non overlapping blocks.
What about /31?
Point to point links use both addresses with no broadcast. Special rules apply.
How do I split a /24 in two?
Two /25 blocks: .0 to .127 and .128 to .255, each with 126 hosts.