🌐 IP Subnet Mask & CIDR Calculator
A subnet mask calculator for IPv4: CIDR prefix, network and broadcast address, usable host range, wildcard mask and host count from any address.
What IP Subnet Mask & CIDR Calculator Does
A subnet mask splits a 32-bit IPv4 address into a network portion and a host portion. Everything to the left of the boundary identifies the network; everything to the right identifies a host inside it. CIDR notation writes that boundary as a prefix length — /24 means the first 24 bits are network.
Classless Inter-Domain Routing replaced the original class A/B/C system in 1993 precisely because fixed boundaries at 8, 16 and 24 bits wasted enormous amounts of address space. A network needing 300 hosts had to take a class B with 65,534, and the address exhaustion that followed is why CIDR exists.
This calculator derives the network address, broadcast address, usable host range, wildcard mask and total host count from any address and prefix length, in both dotted-decimal and CIDR form.
How to Use IP Subnet Mask & CIDR Calculator
- Enter the IP address (e.g. 192.168.1.50)
- Select CIDR prefix (/1 to /32)
- Review usable host range, subnet mask, wildcard mask, and network address
Formula Used by IP Subnet Mask & CIDR Calculator
Usable host count
usable_hosts = 2^(32 − prefix) − 2
- prefix
- CIDR prefix length, the number of network bits
- − 2
- The all-zeros host part is the network address and the all-ones host part is the broadcast address; neither can be assigned to a host
Worked example
The network 192.168.10.0/26.
- Host bits: 32 − 26 = 6
- Total addresses: 2^6 = 64
- Subtract network and broadcast: 64 − 2 = 62
- Block size is 64, so this subnet spans 192.168.10.0 – 192.168.10.63
Result: 62 usable hosts, .1 through .62, with .0 the network and .63 the broadcast address.
Network address
network = IP AND mask
- AND
- Bitwise AND applied octet by octet
Worked example
Host 192.168.10.77 with mask 255.255.255.192 (/26).
- Fourth octet of the address: 77 = 01001101
- Fourth octet of the mask: 192 = 11000000
- Bitwise AND: 01000000 = 64
- The first three octets are unchanged because their mask bits are all ones
Result: Network 192.168.10.64/26 — host range .65 to .126, broadcast .127.
CIDR Prefix Reference
The block size column is the fastest way to find a subnet boundary by hand: subnets start at multiples of the block size.
| CIDR | Subnet mask | Block size | Total addresses | Usable hosts |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 | 2 (point-to-point, RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1 | 1 (single host) |
Private Address Ranges (RFC 1918)
Addresses reserved for internal use and never routed on the public internet.
| Range | CIDR | Addresses | Old class equivalent |
|---|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 16,777,216 | One class A |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Sixteen class Bs |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,536 | 256 class Cs |
How to Read Your Result
Why /31 is an exception
The minus-two rule would leave a /31 with zero usable addresses, which made point-to-point links waste a /30 for decades. RFC 3021 redefined /31 so both addresses are assignable, since a link with exactly two endpoints has no need for a broadcast address.
The block-size shortcut
Subnets always begin at a multiple of their block size. For a /26 the block size is 64, so valid networks in 192.168.10.0/24 are .0, .64, .128 and .192 — and nothing else. This lets you locate any host's network in your head without doing binary arithmetic.
Wildcard masks are not subnet masks
A wildcard mask is the bitwise inverse: /26 has subnet mask 255.255.255.192 and wildcard 0.0.0.63. Cisco ACLs and OSPF use wildcards, where a 0 bit means "must match". Confusing the two silently matches the wrong range rather than erroring.
Limitations & Accuracy Notes
- This calculator covers IPv4 only. IPv6 uses 128-bit addresses with no broadcast address and no minus-two rule — a /64 is the standard subnet size regardless of how many hosts it holds.
- The usable host count is the arithmetic maximum. Real deployments lose addresses to gateways, DHCP reservations, virtual IPs and management interfaces.
- Subnetting maths says nothing about whether a design is sound. Broadcast domain size, VLAN boundaries and routing policy all constrain how large a subnet should actually be.
Frequently Asked Questions
What is CIDR notation in networking?
How do you calculate usable host addresses in a subnet?
How many usable hosts are in a subnet?
What does the number after the slash mean?
Why does a /31 have 2 usable hosts rather than 0?
Which address ranges are private?
What is the difference between a subnet mask and a wildcard mask?
Is anything sent to a server?
References & Further Reading
- RFC 4632 — Classless Inter-domain Routing (CIDR) — The current CIDR address assignment and aggregation specification
- RFC 1918 — Address Allocation for Private Internets — Defines the three private ranges