Subnet Mask Calculator
Enter an IPv4 address and CIDR prefix to calculate subnet details instantly.
What is a subnet mask?
A subnet mask is a 32-bit value used in IPv4 networking to separate the network portion of an IP address from the host portion. It tells routers and hosts which part identifies the subnet and which part identifies a specific device. Without subnet masks, local routing and network segmentation would be impossible.
For example, with the address 192.168.1.34/24, the first 24 bits represent the network and the last 8 bits represent hosts. The corresponding dotted-decimal mask is 255.255.255.0.
Why subnet mask calculation matters
- Efficient IP planning: Allocate only the address space you need.
- Improved security: Segment departments, VLANs, and environments.
- Better performance: Smaller broadcast domains reduce unnecessary traffic.
- Clean troubleshooting: Quickly identify network and broadcast boundaries.
How subnet mask calculation works
1) Start with CIDR notation
CIDR notation uses a slash to define network bits, such as /26 or /30. The number after the slash is the number of 1-bits in the mask.
- /8 = 11111111.00000000.00000000.00000000 = 255.0.0.0
- /16 = 255.255.0.0
- /24 = 255.255.255.0
- /27 = 255.255.255.224
2) Compute host capacity
Host bits = 32 - prefix. Total addresses = 2^(host bits). Traditional usable hosts = 2^(host bits) - 2 (except /31 and /32 special cases).
3) Find key subnet values
- Network address: IP AND subnet mask
- Broadcast address: network OR wildcard mask
- Wildcard mask: inverse of subnet mask
- Usable range: first host through last host
Worked example: 192.168.10.77/27
A /27 mask equals 255.255.255.224. That leaves 5 host bits, so each subnet has 32 total addresses. Block size in the last octet is 32, so subnet boundaries are 0, 32, 64, 96, and so on.
- 77 falls in the 64–95 block
- Network address = 192.168.10.64
- Broadcast address = 192.168.10.95
- Usable hosts = 192.168.10.65 to 192.168.10.94
- Usable host count = 30
Common subnet masks (quick reference)
- /24 → 255.255.255.0 → 254 usable hosts
- /25 → 255.255.255.128 → 126 usable hosts
- /26 → 255.255.255.192 → 62 usable hosts
- /27 → 255.255.255.224 → 30 usable hosts
- /28 → 255.255.255.240 → 14 usable hosts
- /29 → 255.255.255.248 → 6 usable hosts
- /30 → 255.255.255.252 → 2 usable hosts
- /31 → 255.255.255.254 → 2 endpoints (point-to-point)
- /32 → 255.255.255.255 → single host route
Common mistakes to avoid
- Confusing network and broadcast addresses with usable host addresses.
- Forgetting that /31 and /32 have special behavior.
- Mixing up subnet mask and wildcard mask in ACLs.
- Using classful assumptions instead of CIDR-based planning.
Practical tip for network design
When designing subnets, start with required host count per segment, then choose the smallest prefix that satisfies that count. This keeps your address space tidy and scalable. For example, use /27 for a 20-device segment rather than wasting a /24.
Use the calculator above whenever you need fast and accurate subnet details for planning, exams, firewall rules, or troubleshooting.