IPv4 Subnet Calculator: Calculate Network Address, Mask, and Host Range
Calculate subnet masks, network addresses, broadcast addresses, and usable host ranges instantly using CIDR notation for network planning.
Try the free online tool
Runs entirely in your browser — no signup, no uploads.
IP subnetting is one of the foundational skills in networking, yet it can be surprisingly error-prone when calculated by hand. Whether you are provisioning a new AWS VPC, designing a corporate network topology, writing precise firewall rules, or preparing for a networking certification, an accurate subnet calculator removes the risk of miscalculation and speeds up your workflow dramatically. Our IPv4 Subnet Calculator takes a single CIDR block as input and instantly returns the network address, subnet mask, broadcast address, usable host range, and total host count — everything you need to plan and document your network.
Network engineers, cloud architects, DevOps practitioners, and students all need subnetting knowledge on a regular basis. Even experienced engineers use calculators in production environments to eliminate typos or off-by-one errors that could cause routing failures or security gaps. When you configure VPC peering in AWS, define Azure virtual network address spaces, or write iptables rules, being off by a single bit can have serious consequences — blocked traffic, overlapping ranges, or misconfigured NAT rules. This tool gives you an authoritative, verified result in milliseconds.
Beyond raw calculations, understanding what each value means is essential. This guide explains the concepts behind subnetting — CIDR notation, wildcard masks, network classes, and host range arithmetic — so you not only get the right answer but also understand why it is correct. Whether you are splitting a /16 into multiple /24 subnets for department isolation or consolidating smaller ranges into a supernet, the subnet calculator and this accompanying guide will serve as your complete reference.
What Is IPv4 Subnetting?
IPv4 subnetting is the process of dividing a larger IP address space into smaller, logically isolated segments called subnets. Each subnet shares a common network prefix, and devices within the same subnet can communicate directly without passing through a router. The subnet mask defines which portion of an IPv4 address identifies the network and which portion identifies the individual host. For example, in the address 192.168.1.0/24, the /24 indicates that the first 24 bits are the network portion, leaving 8 bits for host addresses — allowing up to 256 total addresses, of which 254 are usable (the first is the network address and the last is the broadcast address).
CIDR (Classless Inter-Domain Routing) notation replaced the older class-based system (Class A, B, C) introduced in the 1980s. The class system was rigid: a Class C network always had a /24 mask, a Class B always /16, and a Class A always /8, regardless of how many hosts were actually needed. CIDR allows any prefix length from /0 to /32, making address allocation far more efficient. An ISP can allocate a /28 (16 addresses) to a small business instead of wasting an entire /24, and a data center can design precise, non-overlapping supernets for routing aggregation.
The key values produced by subnetting arithmetic are: the network address (the first address in the range, used to identify the subnet), the broadcast address (the last address, sent to all hosts in the subnet), the usable host range (all addresses between network and broadcast), the subnet mask in dotted-decimal format (e.g., 255.255.255.0 for /24), the wildcard mask (the bitwise inverse of the subnet mask, used in ACLs and OSPF), and the total number of hosts. Understanding each of these is critical for correct network configuration.
How to Use This Tool
Using the IPv4 Subnet Calculator requires just a CIDR address. Enter your IP range in standard notation and the tool returns all relevant subnet details instantly.
- 1
Enter a CIDR Address
Type an IPv4 address with prefix length in the input field, such as 10.0.0.0/16 or 192.168.5.128/26. You can enter any valid host address within the subnet — the calculator will derive the correct network address automatically.
- 2
Review the Network Address
The network address is the first address in the subnet, obtained by performing a bitwise AND between the IP address and the subnet mask. It cannot be assigned to a host but identifies the entire subnet in routing tables.
- 3
Check the Broadcast Address
The broadcast address is the last address in the subnet, where all host bits are set to 1. Packets sent to the broadcast address are delivered to every host in the subnet. This address also cannot be assigned to a host.
- 4
Note the Usable Host Range
The usable host range spans from network address + 1 to broadcast address - 1. This is the set of addresses you can assign to routers, servers, and workstations. For a /24, that is .1 through .254 — a total of 254 hosts.
- 5
Use the Results in Your Configuration
Copy the subnet mask, CIDR block, or host range directly into your cloud console, firewall rule, router configuration, or network documentation. The tool also shows binary representations for each octet, useful when studying for exams or debugging routing issues.
Common Use Cases
Subnetting is required across nearly every domain of networking and cloud infrastructure. Here are six real-world scenarios where this calculator provides immediate value.
- AWS VPC Design: AWS requires you to specify a CIDR block when creating a VPC. Use the calculator to plan non-overlapping subnets across availability zones (e.g., /20 per AZ within a /16 VPC) before provisioning, avoiding costly reconfiguration later.
- Firewall and ACL Rules: Security group rules, iptables entries, and Cisco ACLs all require precise CIDR notation. The calculator confirms your intended range covers the right addresses — no more accidentally blocking a /25 when you meant a /24.
- Network Segmentation: Enterprise networks isolate departments, IoT devices, or guest Wi-Fi into separate subnets. Use the calculator to allocate appropriately-sized blocks that do not overlap, ensuring clean routing and proper broadcast domain boundaries.
- VLSM (Variable Length Subnet Masking): When subnets within one network need different sizes (e.g., a /30 for point-to-point links and a /22 for a server farm), the calculator helps you quickly size and arrange subnets to fit within a parent block without overlaps.
- Networking Certification Study: CCNA, CompTIA Network+, and similar exams include subnetting questions. The calculator lets you verify your manual calculations and understand the correct process by comparing your working to the tool's output.
- IPv4 Address Auditing: During network audits, administrators enumerate all subnets in use and verify that no two subnets overlap. The calculator confirms boundaries so you can create accurate IP address management (IPAM) documentation.
Key Concepts Explained
CIDR notation combines an IP address with a prefix length separated by a slash. The prefix length (e.g., /24) indicates how many leading bits of the address are fixed as the network portion. The remaining bits are available for host addresses. A /24 has 8 host bits, allowing 2^8 = 256 addresses. A /26 has 6 host bits, allowing 2^6 = 64 addresses (62 usable). As the prefix length increases, the subnet gets smaller.
The subnet mask is a 32-bit number where all network bits are 1 and all host bits are 0. For a /24, the mask is 11111111.11111111.11111111.00000000 in binary, which is 255.255.255.0 in dotted-decimal. Routers apply the subnet mask via bitwise AND to an IP address to extract the network address, then compare that to their routing table to determine the correct next hop.
The wildcard mask is the logical complement of the subnet mask — bits that are 0 in the subnet mask become 1, and vice versa. A /24 subnet mask is 255.255.255.0 and its wildcard mask is 0.0.0.255. Wildcard masks appear in Cisco ACLs and OSPF network statements. They define which bits of an address must match and which bits are "don't care." Understanding wildcard masks is essential for writing efficient access control lists.
Tips and Best Practices
Apply these practical guidelines when working with subnets in real environments to avoid common mistakes and design scalable networks.
- Always plan for growth: choose a subnet size at least twice as large as your current host count to allow for expansion without renumbering. A /25 (126 hosts) is preferable to a /26 (62 hosts) if you anticipate adding 70+ devices within a year.
- Use consistent prefix lengths within the same tier: for example, assign /24 to every VLAN in a campus network and /28 to every point-to-point WAN link. This consistency makes routing tables readable and simplifies troubleshooting.
- Reserve the first and last usable addresses for infrastructure: convention in many organizations is to assign .1 to the default gateway and keep .254 as an admin address, reducing confusion when onboarding new team members.
- Document every subnet immediately: use IPAM tools (Netbox, phpIPAM) or at minimum a spreadsheet to record subnet purpose, VLAN ID, DHCP range, and gateway. Undocumented address spaces become impossible to manage at scale.
- Avoid overlapping ranges across sites: when connecting offices via VPN or peering VPCs, all address spaces must be non-overlapping. Use the calculator to verify each site uses a unique block before establishing tunnels, or routing will silently fail.
Subnetting in Cloud Environments
Cloud platforms add additional constraints to subnetting that do not exist in traditional on-premises networking. In AWS, the first four addresses and the last address in every subnet are reserved by AWS itself, reducing usable hosts beyond the standard two reserved addresses. A /28 in AWS yields only 11 usable addresses instead of 14. Always account for cloud-specific reservations when sizing subnets.
Azure uses a similar reservation scheme, withholding the first three and last address of each subnet for Azure infrastructure. Google Cloud VPCs are global rather than regional, and subnets within a VPC must not overlap regardless of the region they belong to. Before peering two GCP VPCs or establishing a Shared VPC, verify that all subnet CIDR blocks are completely non-overlapping using the subnet calculator.
For Kubernetes deployments, pods and services each require their own CIDR blocks, often /16 or larger. Amazon EKS, Azure AKS, and GKE all need non-overlapping pod CIDRs that do not conflict with node or VPC subnets. Misaligned CIDRs in Kubernetes cause routing asymmetry and connectivity failures that are difficult to diagnose without a clear picture of address allocation — making upfront subnet planning with a calculator indispensable.
Frequently Asked Questions
What is the difference between a subnet mask and a CIDR prefix?
They represent the same information in different formats. A CIDR prefix like /24 indicates that 24 bits are the network portion, while the equivalent subnet mask 255.255.255.0 expresses those same 24 network bits as a 32-bit dotted-decimal number. Both are interchangeable in most contexts, though CIDR notation is more concise and universally preferred in modern networking.
Why are two addresses in each subnet unusable?
The first address in any subnet is the network address, used to identify the subnet itself in routing tables and cannot be assigned to a host. The last address is the broadcast address, used to send a packet to all hosts simultaneously. Assigning either to a device would cause routing and communication errors, so both are always reserved.
How many usable hosts does a /27 subnet provide?
A /27 prefix leaves 5 host bits (32 - 27 = 5), giving 2^5 = 32 total addresses. Subtracting the network address and broadcast address leaves 30 usable host addresses. /27 subnets are common for small office segments or point-to-point links that need more than a /30 provides.
Can I subnet a non-octet-aligned prefix like /19 or /22?
Yes, CIDR supports any prefix from /0 to /32, including non-octet boundaries. A /22 spans four class C blocks (1024 addresses, 1022 usable) and is common for medium-sized VLANs. The subnet calculator handles all prefix lengths correctly, computing the exact network and broadcast addresses using bitwise operations.
What is a supernet and when would I use one?
A supernet aggregates multiple contiguous smaller subnets into a single routing entry with a shorter prefix. For example, four /24 subnets can be summarized as a /22 supernet, reducing routing table size. Supernetting (also called route aggregation or summarization) is used by ISPs and enterprise edge routers to keep routing tables manageable at scale.
How do I split a /24 into four equal subnets?
To create four equal subnets from a /24, borrow 2 bits from the host portion, yielding a /26. Each /26 contains 64 addresses (62 usable). The four subnets are: .0/26 (.1–.62 usable), .64/26 (.65–.126), .128/26 (.129–.190), and .192/26 (.193–.254). Enter each of these into the subnet calculator to confirm their individual boundaries.
Does the calculator support IPv6?
This tool is designed for IPv4 addresses only. IPv6 subnetting follows similar principles but operates on a 128-bit address space with hexadecimal notation. IPv6 prefix lengths typically start at /48 for site allocations and /64 for individual LAN segments. A dedicated IPv6 calculator would be needed for those calculations.
What is a /32 subnet and when is it used?
A /32 is a host route — it addresses exactly one IP address with no host bits remaining. No subnetting is possible. /32 routes appear in routing tables to force traffic for a single host through a specific path, commonly used in loopback interfaces, BGP peer addresses, and cloud security group rules where you want to allow exactly one IP address.
Ready to use this tool?
Free, instant, no account required. Runs entirely in your browser.