IPv4 Subnet Calculator
Enter any IPv4 address and CIDR prefix to instantly calculate network details including subnet mask, host range, broadcast address, and more. A free tool by IPv4Center.
What Is Subnetting?
Subnetting is the practice of dividing a larger IP network into smaller, more manageable sub-networks (subnets). It improves network performance, enhances security by isolating segments, and makes efficient use of limited IPv4 address space. Each subnet is defined by a network address and a subnet mask that determines how many host addresses are available within it. Learn more in our subnetting guide.
How Subnet Calculators Work
A subnet calculator takes an IPv4 address and a CIDR prefix length (e.g., /24) and performs bitwise operations to determine the network address, broadcast address, valid host range, and subnet mask. The CIDR prefix indicates how many leading bits of the 32-bit IP address represent the network portion — the remaining bits are available for host addresses within that subnet.
Common Subnet Reference
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /32 | 255.255.255.255 | 1 |
| /31 | 255.255.255.254 | 2 (point-to-point) |
| /30 | 255.255.255.252 | 2 |
| /29 | 255.255.255.248 | 6 |
| /28 | 255.255.255.240 | 14 |
| /27 | 255.255.255.224 | 30 |
| /26 | 255.255.255.192 | 62 |
| /25 | 255.255.255.128 | 126 |
| /24 | 255.255.255.0 | 254 |
| /23 | 255.255.254.0 | 510 |
| /22 | 255.255.252.0 | 1,022 |
| /21 | 255.255.248.0 | 2,046 |
| /20 | 255.255.240.0 | 4,094 |
| /19 | 255.255.224.0 | 8,190 |
| /18 | 255.255.192.0 | 16,382 |
| /17 | 255.255.128.0 | 32,766 |
| /16 | 255.255.0.0 | 65,534 |
| /8 | 255.0.0.0 | 16,777,214 |
Variable Length Subnet Masking (VLSM)
Variable Length Subnet Masking (VLSM) allows network administrators to divide an IP address space into subnets of different sizes, rather than using a single fixed subnet mask across the entire network. VLSM was formalized in RFC 1878, which defined the valid subnet masks for IPv4, including all 32 prefix lengths from /1 through /32.
Before VLSM, classful networking forced organizations to use a single subnet mask for every subnet within a major network. A company with a Class B address (e.g., 172.16.0.0/16) had to apply the same mask everywhere — wasting thousands of addresses on point-to-point links that only need 2. VLSM eliminates this waste by allowing a /30 (2 usable hosts) on a router-to-router link, a /24 (254 usable hosts) for an office LAN, and a /22 (1,022 usable hosts) for a data center segment, all within the same address block.
To implement VLSM, start by allocating the largest subnet first. For example, from 10.1.0.0/16, assign 10.1.0.0/22 (1,022 hosts) to the largest department, then 10.1.4.0/24 (254 hosts) to a medium office, 10.1.5.0/27 (30 hosts) to a small team, and 10.1.5.32/30 (2 hosts) to a WAN link. Each allocation begins at the next available network boundary, ensuring no overlap.
IPv4 Subnet Quick Reference
A /8 subnet uses mask 255.0.0.0 and provides exactly 16,777,214 usable host addresses across 16,777,216 total addresses. A /16 subnet (255.255.0.0) provides 65,534 usable hosts. A /20 subnet (255.255.240.0) provides 4,094 usable hosts and is commonly used for large cloud VPC segments.
A /24 subnet provides exactly 254 usable host addresses out of 256 total addresses, with subnet mask 255.255.255.0. This is the most widely deployed subnet size for office LANs and small network segments. A /25 (255.255.255.128) splits a /24 in half, yielding 126 usable hosts per subnet. A /26 (255.255.255.192) provides 62 usable hosts and is ideal for departments with 40–60 devices.
Smaller subnets serve specialized roles. A /27 (255.255.255.224) provides 30 usable hosts, suitable for conference rooms and IoT segments. A /28 (255.255.255.240) provides 14 usable hosts, commonly used for DMZ segments and server VLANs. A /30 (255.255.255.252) provides exactly 2 usable hosts and is the standard for point-to-point router links. Per RFC 3021, a /31 (255.255.255.254) can also be used for point-to-point links without wasting addresses on network and broadcast designations. A /32 (255.255.255.255) identifies a single host and is used for loopback interfaces and host routes.
Subnetting Best Practices for Network Design
Effective subnet design balances address efficiency with room for growth. The general rule is to choose a prefix length that accommodates the current device count plus 50–100% growth headroom. For a department with 80 workstations, a /24 (254 hosts) provides adequate room, whereas a /25 (126 hosts) would be too tight after adding printers, access points, and IP phones.
Align subnet boundaries with organizational and security boundaries. Each VLAN should map to one subnet, isolating broadcast domains and simplifying firewall rules. Place servers in dedicated /27 or /28 subnets behind strict access controls. Guest Wi-Fi networks should use their own /24 segment with separate DHCP scope and internet-only routing to prevent lateral movement into corporate networks.
For WAN design, use /30 subnets for traditional point-to-point links or /31 subnets per RFC 3021 to conserve addresses. Assign management interfaces and loopbacks from a dedicated /24 block using /32 host routes — this simplifies OSPF and BGP route advertisements. When designing supernets for route aggregation, choose CIDR boundaries that align on power-of-two boundaries (e.g., aggregate four contiguous /24 networks into a single /22) to keep routing tables compact and reduce convergence time.