IPv4 Subnet Calculator
Calculate network, broadcast, and host range from CIDR notation
The IPv4 Subnet Calculator takes any IPv4 address with CIDR notation and instantly computes the network address, broadcast address, subnet mask, usable host range, and total host count. Enter a value like 192.168.1.0/24 or 10.0.0.1/16 to get complete subnet details.
Understanding Subnetting
If you manage servers, switches, or firewalls, subnetting is one of the first things you need to get right. Every device on an IP network belongs to a subnet, and the subnet defines which other devices it can talk to directly. Get the boundaries wrong and traffic silently disappears, DHCP hands out addresses that collide, or firewall rules open the wrong range.
A subnet is just a contiguous block of IP addresses that share the same network prefix. When you write 192.168.1.0/24, the /24 means the first 24 bits are the network portion and the remaining 8 bits identify individual hosts. That single notation tells you the subnet mask (255.255.255.0), the range of usable addresses (.1 through .254), and the broadcast address (.255) -- all without doing any math yourself.
This calculator does that math for you. You give it any IP and prefix length, and it returns every detail you need: network address, broadcast address, subnet mask in dotted decimal, first and last usable host, and total host count. Whether you are carving a /16 campus network into VLANs or sizing a /28 DMZ for a handful of servers, the output tells you exactly what range you are working with.
How to Calculate IPv4 Subnets from CIDR Notation
- Enter an IPv4 address with a CIDR prefix length (e.g.,
192.168.1.100/24) - The calculator performs a bitwise AND between the IP and subnet mask to derive the network address
- Host bits are set to all 1s to compute the broadcast address
- The first usable host (network + 1) and last usable host (broadcast - 1) define the host range
- Results display the subnet mask in dotted decimal, total addresses, and usable host count
IPv4 Subnet Calculation Examples
| Input | Network Address | Broadcast Address | Subnet Mask | Usable Hosts |
|---|---|---|---|---|
192.168.1.100/24 | 192.168.1.0 | 192.168.1.255 | 255.255.255.0 | 254 |
10.0.0.1/8 | 10.0.0.0 | 10.255.255.255 | 255.0.0.0 | 16,777,214 |
172.16.5.130/20 | 172.16.0.0 | 172.16.15.255 | 255.255.240.0 | 4,094 |
192.168.10.50/28 | 192.168.10.48 | 192.168.10.63 | 255.255.255.240 | 14 |
10.1.1.1/30 | 10.1.1.0 | 10.1.1.3 | 255.255.255.252 | 2 |
172.16.0.1/16 | 172.16.0.0 | 172.16.255.255 | 255.255.0.0 | 65,534 |
When to Use This Tool
- Planning new network segments -- determine the correct prefix length for the number of hosts you need
- Configuring routers and firewalls -- verify network and broadcast addresses before writing rules
- Setting up DHCP scopes -- identify the usable host range for address assignment
- Troubleshooting connectivity -- confirm that two devices are on the same subnet
- Documenting infrastructure -- record accurate network boundaries for each VLAN or segment
- Validating firewall rules -- ensure ACLs reference the correct network address
How IPv4 Subnetting Works
Bitwise AND Operation
Subnetting divides an IPv4 address into a network portion and a host portion using a subnet mask. The network address is found by performing a bitwise AND between the IP address and the mask.
For 192.168.1.100/24:
IP Address: 11000000.10101000.00000001.01100100 (192.168.1.100)
Subnet Mask: 11111111.11111111.11111111.00000000 (255.255.255.0)
ββββββββββββββββββββββββββββββββββββββ
Network Addr: 11000000.10101000.00000001.00000000 (192.168.1.0)
Common Prefix Lengths
| Prefix | Subnet Mask | Total Addresses | Usable Hosts | Typical Use |
|---|---|---|---|---|
/8 | 255.0.0.0 | 16,777,216 | 16,777,214 | Large enterprise or ISP blocks |
/16 | 255.255.0.0 | 65,536 | 65,534 | Campus or site-level allocation |
/24 | 255.255.255.0 | 256 | 254 | Standard LAN segment |
/28 | 255.255.255.240 | 16 | 14 | Small department or DMZ |
/30 | 255.255.255.252 | 4 | 2 | Point-to-point router links |
/32 | 255.255.255.255 | 1 | 1 | Single host route (loopback) |
Reserved Addresses in Every Subnet
Every IPv4 subnet reserves two addresses that cannot be assigned to hosts:
- Network address -- all host bits set to 0, identifies the subnet itself
- Broadcast address -- all host bits set to 1, used to send traffic to all hosts on the segment
The exception is /31 subnets (RFC 3021), which eliminate the broadcast address for point-to-point links, yielding 2 usable addresses from 2 total.
Subnetting in Practice
The most common mistake in subnet planning is sizing too tightly. A subnet that fits your current device count with no room to spare will cause problems the moment you add a printer, an access point, or a monitoring appliance. As a general rule, pick a prefix length that gives you at least 30-50% headroom beyond your current count. If you have 80 devices on a floor, a /25 (126 usable hosts) works today but a /24 (254 usable hosts) gives you room for the next two years of growth without re-addressing.
The second most common mistake is subnetting without a plan. It is tempting to hand out /24 blocks to every department, but that wastes address space in small offices and creates fragmented routing tables. Start with your largest allocation (maybe a /16 from RFC 1918 space) and divide it hierarchically: sites get /20 or /22 blocks, buildings get /23 or /24 blocks within those, and individual VLANs get /25 or /26 blocks as needed. This structure keeps your routing tables clean and makes it easy to summarize routes at each aggregation point.
Point-to-point links between routers are a special case. These links only connect two interfaces, so a /30 (2 usable hosts) or /31 (2 usable hosts with no broadcast) is the correct choice. Using a /24 for a WAN link wastes 252 addresses and can confuse junior engineers who see the gap in the address plan.
Frequently Asked Questions
How many usable hosts does a /24 subnet have?
A /24 subnet contains 256 total addresses (2^8). Two are reserved: the network address (e.g., 192.168.1.0) and the broadcast address (e.g., 192.168.1.255). That leaves 254 usable host addresses, from .1 through .254. This is the most common subnet size for LANs and VLANs.
What is the difference between /24 and 255.255.255.0?
They are two notations for the same thing. /24 is CIDR (Classless Inter-Domain Routing) notation indicating 24 network bits. 255.255.255.0 is the same mask in dotted decimal format. CIDR notation is more compact and is the standard in modern configurations, while dotted decimal is still used in older equipment and some Cisco IOS commands.
Can I subnet on non-octet boundaries like /20 or /28?
Yes. CIDR allows subnetting at any bit position from /1 to /32. A /20 splits the third octet, giving you 4,094 usable hosts. A /28 provides 14 usable hosts. The calculator handles all prefix lengths and shows the exact boundaries regardless of where the split falls.
What is the right subnet size for my network?
Choose a prefix length that covers your current device count plus 30-50% growth. For 100 devices, a /25 (126 usable hosts) is tight, while a /24 (254 usable hosts) offers comfortable room. For just two routers on a WAN link, a /30 or /31 is the standard choice.
What are RFC 1918 private address ranges?
RFC 1918 reserves three blocks for private use: 10.0.0.0/8 (16.7 million addresses), 172.16.0.0/12 (1 million addresses), and 192.168.0.0/16 (65,536 addresses). These ranges are not routed on the public internet, making them the standard choice for internal networks behind NAT. Most organizations use 10.0.0.0/8 because it provides the most space for hierarchical subnet plans.
Why does my host count not match what I expected?
The most likely cause is forgetting the two reserved addresses. A /24 has 256 total addresses but only 254 usable hosts, because the network address and broadcast address cannot be assigned to devices. For very small subnets this is significant: a /29 has 8 total addresses but only 6 usable hosts, a /30 has 4 total but only 2 usable.
Related Tools
- IPv6 Subnet Calculator - Calculate IPv6 prefix ranges and address boundaries
- Netmask β CIDR Converter - Convert between subnet mask notation and CIDR prefix length
- Network Address Calculator - Find the network address for any IP and subnet mask
- Broadcast Address Calculator - Find the broadcast address for any subnet
- First/Last Usable Host Calculator - Find the first and last usable host addresses in a subnet
- VLSM Calculator - Calculate Variable Length Subnet Masks for efficient address allocation
- Subnet Allocation Planner - Plan hierarchical subnet allocations for multi-site networks