Subnet Calculator
Subnet Calculator
e.g., 192.168.1.0
Subnet Calculator
Subnet Calculator — Frequently Asked Questions
Common questions about subnet.
Last updated Mar 2026
What a Subnet Calculator Does (and Why You’d Use It)
- Subnet mask: The 32-bit mask that separates the network portion from the host portion. - Network address: The first address in the subnet (all host bits set to 0). - Broadcast address: The last address in the subnet (all host bits set to 1). - Usable IP range: The assignable host addresses between network and broadcast (with special rules for /31 and /32). - Wildcard mask: The inverse of the subnet mask (useful in ACLs and some routing configs). - Host counts: total and usable.
On ProcalcAI, you enter an IP Address (dotted decimal) and a CIDR Prefix, and the calculator returns all of the above instantly.
Inputs You Provide: IP Address and CIDR Prefix
1) IP Address (example: 192.168.1.130) 2) CIDR Prefix (example: 26, meaning /26)
The CIDR prefix is the number of network bits in the 32-bit IPv4 address. The remaining bits are host bits.
- /24 means 24 network bits and 8 host bits - /26 means 26 network bits and 6 host bits - /30 means 30 network bits and 2 host bits
Host bits determine how many addresses exist in the subnet: - Total addresses = 2^(32 − prefix)
How the Calculator Computes Each Result (Logic You Can Follow)
### Step 1: Convert the IP to a 32-bit integer An IPv4 address a.b.c.d becomes:
ipNum = (a << 24) | (b << 16) | (c << 8) | d
Example: 192.168.1.130 becomes: - 192 << 24 - 168 << 16 - 1 << 8 - 130
This is just a compact way to do math on the address.
### Step 2: Build the subnet mask from the prefix The mask is 32 bits of 1s for the network portion, then 0s for the host portion:
mask = (0xFFFFFFFF << (32 − prefix)) (with special handling for prefix 0)
So: - /24 mask = 255.255.255.0 - /26 mask = 255.255.255.192 - /30 mask = 255.255.255.252
This is the subnet mask output.
### Step 3: Compute the network address Network address is the IP with host bits forced to 0:
network = ipNum AND mask
That’s the network address output.
### Step 4: Compute the broadcast address Broadcast is the network with all host bits set to 1:
broadcast = network OR (NOT mask)
That’s the broadcast address output.
### Step 5: Compute usable host range (with /31 and /32 rules) Normally: - first host = network + 1 - last host = broadcast − 1 - usable hosts = total − 2 (excluding network and broadcast)
But the calculator treats prefixes >= 31 differently: - If prefix is /31 or /32, it does not subtract 2. - first host = network - last host = broadcast - usable hosts = total
This matches common practice for point-to-point links on /31, and single-host networks on /32.
### Step 6: Wildcard mask Wildcard is the inverse of the subnet mask:
wildcard = NOT mask
Example: - mask 255.255.255.0 → wildcard 0.0.0.255
Worked Example 1: 192.168.1.130/26
1) Prefix: /26 Host bits = 32 − 26 = 6 Total addresses = 2^6 = 64 Usable addresses (since /26 < /31) = 64 − 2 = 62
2) Subnet mask for /26 Binary mask ends with 6 host zeros, so last octet is 11000000 = 192 Subnet mask = 255.255.255.192
3) Block size (quick mental check) Block size = 256 − 192 = 64 So subnets in the last octet start at 0, 64, 128, 192
Given IP is 192.168.1.130, it falls in the 128–191 block.
4) Network address Network = 192.168.1.128
5) Broadcast address Broadcast = 192.168.1.191
6) Usable range First host = 192.168.1.129 Last host = 192.168.1.190
Summary: - Subnet mask: 255.255.255.192 - Network address: 192.168.1.128 - Broadcast address: 192.168.1.191 - Usable IP range: 192.168.1.129 to 192.168.1.190 - Total hosts: 64, Usable hosts: 62 - Wildcard mask: 0.0.0.63
Worked Example 2: 10.0.5.77/20
1) Prefix: /20 Host bits = 12 Total addresses = 2^12 = 4096 Usable addresses = 4096 − 2 = 4094
2) Subnet mask for /20 /20 means: - First 16 bits: 255.255 - Next 4 bits in the third octet are network bits: 11110000 = 240 Subnet mask = 255.255.240.0
3) Block size in the third octet Block size = 256 − 240 = 16 So third-octet subnet ranges are 0–15, 16–31, 32–47, 48–63, 64–79, etc.
Given IP is 10.0.5.77, the third octet is 5, which falls in 0–15.
4) Network address Network = 10.0.0.0
5) Broadcast address Broadcast = 10.0.15.255
6) Usable range First host = 10.0.0.1 Last host = 10.0.15.254
Summary: - Subnet mask: 255.255.240.0 - Network address: 10.0.0.0 - Broadcast address: 10.0.15.255 - Usable IP range: 10.0.0.1 to 10.0.15.254 - Total hosts: 4096, Usable hosts: 4094 - Wildcard mask: 0.0.15.255
Worked Example 3: 172.16.9.10/31 (the special case)
2) Subnet mask for /31 Subnet mask = 255.255.255.254
3) Determine the network With /31, addresses come in pairs (…8 and …9, …10 and …11, etc.). 172.16.9.10 is even, so the pair is 172.16.9.10–172.16.9.11.
- Network address = 172.16.9.10 - Broadcast address = 172.16.9.11
4) Usable range (special handling) First host = 172.16.9.10 Last host = 172.16.9.11
Summary: - Subnet mask: 255.255.255.254 - Network address: 172.16.9.10 - Broadcast address: 172.16.9.11 - Usable IP range: 172.16.9.10 to 172.16.9.11 - Total hosts: 2, Usable hosts: 2 - Wildcard mask: 0.0.0.1
Pro Tips for Using the Subnet Calculator
Common Mistakes (and How to Avoid Them)
Authoritative Sources
This calculator uses formulas and reference data drawn from the following sources:
- DigiPen Institute of Technology - NIST — Cybersecurity - IEEE
Subnet Formula & Method
This subnet calculator uses standard technology formulas to compute results. Enter your values and the formula is applied automatically — all math is handled for you. The calculation follows industry-standard methodology.
Subnet Sources & References
Explore More Calculators
Content reviewed by the ProCalc.ai editorial team · About our standards