e.g., 192.168.1.0
Subnet Calculator
How Subnet Masks and CIDR Notation Work
Planning IP space gets messy fast once you’re splitting networks, checking ranges, and trying not to overlap subnets. ProcalcAI’s Subnet Calculator keeps it straightforward by turning an IP address and CIDR into the exact details you need: subnet mask, network address, broadcast address, and the usable host range. You enter an IPv4 address with CIDR notation (like 10.20.30.40/27), and the Subnet Calculator immediately returns the calculated boundaries so you can document, deploy, or troubleshoot with confidence. Network administrators, DevOps engineers, and IT support teams use it when they’re carving up address space for VLANs, VPN tunnels, lab environments, or cloud VPC subnets. For example, when you’re adding a new /28 for a branch office and need to confirm the first and last usable IPs before assigning a gateway and DHCP scope, you can run the numbers in seconds and avoid an outage caused by a bad range. With clear outputs you can copy into configs and tickets, you spend less time doing binary math and more time shipping the change.
What is a subnet mask?
A subnet mask divides an IP address into a network portion and a host portion. It determines how many devices can exist on a network segment. Common masks include /24 (255.255.255.0, 254 hosts) and /16 (255.255.0.0, 65,534 hosts).
What Subnetting Does
Subnetting divides a larger network into smaller, more manageable segments. Each subnet gets its own range of IP addresses, network address, and broadcast address. This is fundamental to network design — it controls traffic flow, improves security by isolating segments, and makes efficient use of limited IP address space. Every network engineer, system administrator, and IT student needs to understand subnetting.
How This Calculator Works
Enter any IPv4 address and a CIDR prefix length (the number after the slash, like /24). The calculator returns the subnet mask in dotted decimal notation, the network address, the broadcast address, the range of usable host addresses, and the total number of usable hosts. A /24 network gives you 254 usable addresses. A /28 gives you 14. The math is binary — the prefix length determines how many bits identify the network versus hosts.
Common Subnet Sizes
A /24 (255.255.255.0) is the most common subnet for small office and home networks — 254 hosts. A /16 gives you over 65,000 hosts and is typical for larger corporate networks. Cloud providers often use /28 or /27 subnets for small service groups. When planning VPC networks in AWS, Azure, or GCP, knowing your subnet math prevents wasted address space and overlapping ranges that cause routing headaches later.
Related Tools
For general unit conversion between networking measurements, try the Storage Converter. To estimate how long a file transfer takes across your network, use the Download Time Calculator. For checking the strength of network credentials, see the Password Strength Calculator.
Subnet Calculator — Frequently Asked Questions(8)
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