Last updated: June 2026
By CalcOrigin Editorial Team
About IP Subnet Calculator
The IP subnet calculator is a free online tool that helps network administrators, IT professionals, and students calculate detailed information about IPv4 and IPv6 subnets. By entering an IP address and selecting a subnet mask or prefix length, the calculator instantly returns the network address, broadcast address, usable host range, CIDR notation, IP class, and much more. Whether you are designing a new network, troubleshooting connectivity issues, or studying for a networking certification, this tool simplifies complex subnet calculations that would otherwise require manual binary math.
Subnetting is a fundamental concept in computer networking that involves dividing a larger network into smaller, more manageable subnetworks. This practice improves network performance, enhances security by isolating traffic between segments, and makes more efficient use of IP address space. The IP subnet calculator on this page supports both IPv4 with CIDR notation and IPv6, making it a versatile tool for modern network environments that increasingly rely on IPv6 addressing alongside traditional IPv4 networks.
This calculator also provides supplementary information including the wildcard mask (useful for access control lists), binary representation of the subnet mask, the IP address in hex and integer formats, reverse DNS lookup format (in-addr.arpa), and the IPv4 mapped address for IPv6 transition. For those working with network design, our binary calculator can help with the underlying binary arithmetic that powers all subnet calculations.
How Subnetting Works
Subnetting works by borrowing bits from the host portion of an IP address and using them for the network portion. Each time you borrow a bit, you double the number of possible subnets but halve the number of available hosts per subnet. The subnet mask determines exactly how many bits are allocated to the network and host portions respectively, and this is why understanding the relationship between subnet masks and address ranges is essential for effective network design.
A router uses the subnet mask to determine whether a destination IP address is on the same local network or a different one. If the network portions match, the destination is local and the router forwards the packet directly. If they differ, the router sends the packet to another router for delivery. This is the fundamental routing decision that happens at every network hop, and it is made possible by the subnetting structure defined in the network configuration.
When you use the IP subnet calculator, it performs the bitwise AND operation between your IP address and subnet mask to calculate the network address. It also calculates the broadcast address by setting all host bits to 1. The usable host range consists of all addresses between the network and broadcast addresses, giving you a complete picture of the address space available for your devices. For a broader understanding of network address management, our hex calculator is useful for working with hexadecimal representations used in IPv6 and MAC addresses.
Subnetting is used in virtually every modern network, from home Wi-Fi networks to global enterprise infrastructures. In a home network, the router typically uses a /24 subnet (255.255.255.0) providing up to 254 devices. In enterprise environments, network engineers create multiple subnets to separate departments like finance, HR, and engineering, improving both security and performance by containing broadcast traffic within each subnet. The calculator on this page helps you plan these subdivisions by showing exactly how many subnets and hosts each mask length provides for your specific IP address.
IPv4 Addresses
IPv4 (Internet Protocol version 4) is the most widely deployed network addressing architecture in the world, even as the world transitions to IPv6. An IPv4 address is a 32-bit number typically written in dot-decimal notation as four octets separated by periods, such as 192.168.1.1. Each octet ranges from 0 to 255, giving approximately 4.3 billion possible addresses. However, due to the hierarchical structure of subnetting and address allocation, the effective number of usable addresses is significantly lower.
An IPv4 address consists of two main parts: the network prefix (also called the routing prefix) which identifies the network segment, and the host identifier which identifies a specific device within that network. The subnet mask defines the boundary between these two parts. For example, in the address 192.168.1.100 with a 255.255.255.0 (/24) mask, the network portion is 192.168.1 and the host portion is 100.
The key formulas used by this calculator are:
Network Address = IP Address AND Subnet Mask
Broadcast Address = Network Address OR (NOT Subnet Mask)
Total Hosts = 2^(32 - prefix_length)
Usable Hosts = Total Hosts - 2
IPv4 addresses are now largely exhausted at the IANA level, which is why techniques like NAT (Network Address Translation), CIDR, and private addressing have become essential for extending the usability of IPv4 until IPv6 is universally adopted. Understanding IPv4 subnetting remains a critical skill for network professionals, and this calculator helps bridge the gap between theory and practical application.
IPv6 Addresses
IPv6 (Internet Protocol version 6) was developed specifically to address the exhaustion of IPv4 addresses and introduces several improvements beyond just a larger address space. IPv6 uses 128-bit addresses compared to 32 bits in IPv4, providing approximately 340 undecillion addresses — enough to assign an IP address to every atom on the surface of the Earth many times over. An IPv6 address is written as eight groups of four hexadecimal digits separated by colons, such as 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
IPv6 simplifies subnetting by using a fixed prefix length concept. The network prefix (similar to the subnet mask in IPv4) is expressed as a slash followed by the prefix length, such as /64. The Internet Engineering Task Force (IETF) recommends using /64 subnets for most local networks because it provides enough address space for stateless address autoconfiguration (SLAAC) and other IPv6 features. The structure divides into the global routing prefix, subnet ID, and interface ID portions.
Key IPv6 formulas used:
Network Address = IP Prefix / Prefix Length
Total Addresses = 2^(128 - prefix_length)
Total /64 Networks in Prefix = 2^(prefix_length - 64)
IPv6 eliminates the need for NAT (Network Address Translation) because every device can have a globally unique public address. This simplifies network architecture, improves end-to-end connectivity, and removes the complexity that NAT introduces for applications like peer-to-peer communication and online gaming. However, IPv6 adoption has been gradual, and most networks today operate in a dual-stack configuration supporting both IPv4 and IPv6 simultaneously during the transition period.
Subnet Mask Types Explained
A subnet mask is a 32-bit value that tells network devices which portion of an IP address is the network identifier and which portion is the host identifier. Subnet masks are written in the same dot-decimal format as IP addresses but have a specific structure: the network bits are all 1s (binary) and the host bits are all 0s. This means subnet masks always follow a pattern of consecutive 1s followed by consecutive 0s, with no intermixing.
Default subnet masks correspond to the traditional class-based system. Class A uses 255.0.0.0 (/8), Class B uses 255.255.0.0 (/16), and Class C uses 255.255.255.0 (/24). These are the simplest masks and create the largest possible host ranges for each class. However, default masks are rarely used in modern networks because they are too inflexible for efficient address allocation.
Custom subnet masks extend beyond the default by borrowing host bits. For example, a Class C network using 255.255.255.192 (/26) borrows 2 additional bits, creating 4 subnets of 62 usable hosts each. This is the essence of subnetting — trading available host addresses for additional network segments. The IP subnet calculator on this page works with any valid subnet mask, from /0 to /32 for IPv4, allowing you to experiment with different mask lengths and immediately see the impact on network size and host count.
CIDR Notation Guide
CIDR (Classless Inter-Domain Routing) notation, introduced in 1993, replaced the older classful network addressing system. It allows for more flexible and efficient allocation of IP addresses by eliminating the rigid class boundaries. CIDR notation represents an IP address followed by a slash and the number of bits in the network prefix, such as 192.168.1.0/24. This simple notation conveys both the network address and the subnet mask in a compact, unambiguous format.
Before CIDR, IP addresses were allocated based on class (A, B, or C), which led to significant waste. A Class A network provided 16 million addresses, far more than most organizations needed, while a Class C network provided only 254 — often too few. CIDR solved this by allowing network sizes to be specified with arbitrary prefix lengths, enabling much finer granularity in address allocation. For example, a /28 network provides 16 addresses (14 usable), which is ideal for small branch offices.
The CIDR prefix length directly corresponds to the subnet mask. A /24 equals 255.255.255.0, a /25 equals 255.255.255.128, and a /26 equals 255.255.255.192. Each increment in the prefix length reduces the address space by half. The IP subnet calculator displays both CIDR notation and the corresponding subnet mask simultaneously, helping you build intuition for the relationship between them. For quick binary and decimal conversions needed in networking, our binary calculator is a useful companion tool.
Public vs Private IP Addresses
IP addresses are categorized as either public (globally routable) or private (local use only). Understanding this distinction is essential when using the IP subnet calculator because the calculator identifies the IP type and helps you plan your network addressing scheme accordingly. Public IP addresses are unique across the entire internet and must be registered with a regional internet registry, while private addresses can be used freely within local networks without registration.
Private IP ranges (defined in RFC 1918) are reserved for internal use and are not routable on the public internet:
- 10.0.0.0/8 — 10.0.0.0 to 10.255.255.255 (16,777,216 addresses) — used by large organizations
- 172.16.0.0/12 — 172.16.0.0 to 172.31.255.255 (1,048,576 addresses) — medium networks
- 192.168.0.0/16 — 192.168.0.0 to 192.168.255.255 (65,536 addresses) — home and small office
NAT (Network Address Translation) allows private IP addresses to communicate with the public internet by mapping multiple private addresses to a single public IP. This is why home routers can connect multiple devices using a single internet connection. When you enter an IP address into the subnet calculator, it automatically detects whether the address falls within a private range or is a public address, helping you understand the context of your network configuration.
A special category of IP addresses is the link-local range (169.254.0.0/16), which devices use for Automatic Private IP Addressing (APIPA) when they cannot reach a DHCP server or other configuration source. These addresses are automatically assigned and allow communication only within the local network segment. Another important reserved range is 127.0.0.0/8 for loopback addresses, with 127.0.0.1 being the most commonly used for local software testing. The subnet calculator correctly identifies these special-purpose addresses and their associated network characteristics.
IP Address Classes (A, B, C, D, E)
The traditional IP address class system divides IPv4 addresses into five classes based on the first few bits of the address. While CIDR has largely replaced classful networking, understanding IP classes remains valuable for historical context and because many networks still reference class concepts. The IP subnet calculator identifies the class of any IPv4 address automatically, helping you understand its place in the traditional classification system.
Class A (1.0.0.0 - 126.0.0.0): Default mask /8 (255.0.0.0). Designed for very large networks with up to 16 million hosts. The first bit is always 0. Class A addresses are assigned to large organizations and internet backbone providers.
Class B (128.0.0.0 - 191.255.0.0): Default mask /16 (255.255.0.0). Designed for medium-sized networks with up to 65,534 hosts. The first two bits are 10. Used by universities, mid-sized companies, and ISPs.
Class C (192.0.0.0 - 223.255.255.0): Default mask /24 (255.255.255.0). Designed for small networks with up to 254 hosts. The first three bits are 110. This is the most common class for small businesses and home networks.
Class D (224.0.0.0 - 239.255.255.255): Reserved for multicast groups. The first four bits are 1110. Class D addresses are not used for standard unicast communication and are instead used for one-to-many multicast delivery.
Class E (240.0.0.0 - 255.255.255.255): Reserved for experimental use. The first four bits are 1111. These addresses are not used on the public internet and are reserved for research and development purposes.
How to Calculate Subnet Hosts
Calculating the number of usable hosts in a subnet is one of the most common tasks for network administrators. The formula depends on the prefix length (CIDR notation) and is straightforward once you understand the relationship between bits and addresses. The IP subnet calculator performs this calculation instantly, but knowing the manual method helps you verify results and understand your network design.
Step 1: Determine the number of host bits. For IPv4, this is 32 minus the prefix length. For example, a /26 network has 32 - 26 = 6 host bits.
Step 2: Calculate the total number of addresses using the formula 2^(host bits). For /26, that is 2^6 = 64 total addresses.
Step 3: Subtract 2 for the network address (all host bits 0) and the broadcast address (all host bits 1). This gives 64 - 2 = 62 usable host addresses.
Here is a quick reference for common prefix lengths:
| CIDR | Subnet Mask | Total Addresses | Usable Hosts |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
VLSM — Variable Length Subnet Masks
Variable Length Subnet Masking (VLSM) allows network administrators to use different subnet mask lengths for different subnets within the same major network. This is a significant improvement over fixed-length subnet masking (FLSM), where all subnets must use the same mask size. VLSM enables much more efficient use of IP address space by matching subnet sizes to the actual number of hosts needed in each network segment.
For example, consider a company with the 192.168.1.0/24 network that needs three subnets: one for 100 hosts, one for 50 hosts, and one for 20 hosts. With FLSM, all subnets would need a /25 mask (126 usable hosts each), wasting significant address space. With VLSM, you can allocate a /25 subnet (126 hosts) for the 100-host segment, a /26 subnet (62 hosts) for the 50-host segment, and a /27 subnet (30 hosts) for the 20-host segment — using only 218 of 256 available addresses.
The IP subnet calculator supports VLSM by allowing you to quickly test different prefix lengths for any given IP address. By experimenting with different subnet masks, you can plan your VLSM scheme efficiently and verify that your subnets do not overlap. Proper VLSM design requires careful planning to avoid overlapping address ranges, and the calculator's subnet table view helps visualize how different subnets fit within the overall address space.
Common Subnet Sizes Reference
Having a reference for common subnet sizes helps network professionals quickly identify the appropriate prefix length for different scenarios. The IP subnet calculator makes it easy to look up any prefix length, but memorizing the most commonly used sizes speeds up network design and troubleshooting. Here is a comprehensive reference table for IPv4 subnet sizes from /8 to /30:
| CIDR | Subnet Mask | Total IPs | Usable Hosts | Common Use |
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | Very large networks |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large organizations |
| /24 | 255.255.255.0 | 256 | 254 | Standard LAN |
| /25 | 255.255.255.128 | 128 | 126 | Small office |
| /26 | 255.255.255.192 | 64 | 62 | Small department |
| /27 | 255.255.255.224 | 32 | 30 | Workgroup |
| /28 | 255.255.255.240 | 16 | 14 | Small workgroup |
| /29 | 255.255.255.248 | 8 | 6 | Router links |
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point links |
| /32 | 255.255.255.255 | 1 | 1 | Single host |
For IPv6, the recommended subnet size for most local networks is /64, which provides 2^64 addresses — more than enough for any practical network. The /64 recommendation ensures compatibility with SLAAC and other IPv6 features such as privacy extensions and temporary address generation. Larger organizations might receive a /48 or /56 prefix from their ISP, allowing them to create many /64 subnets for different segments of their network infrastructure while maintaining efficient routing table aggregation.
Binary Basics for Subnetting
Understanding binary arithmetic is fundamental to mastering subnetting because all IP addresses and subnet masks are ultimately binary numbers at their core. The IP subnet calculator displays the binary representation of the subnet mask, helping you build the mental connection between the dotted-decimal format you configure on devices and the binary operations performed by network hardware.
An IPv4 address is a 32-bit binary number. Each octet (8 bits) corresponds to one decimal number in the dotted-decimal format. The binary place values within each octet are 128, 64, 32, 16, 8, 4, 2, and 1. For example, the decimal value 192 in binary is 11000000 (128 + 64), and 168 is 10101000 (128 + 32 + 8). The subnet calculator shows this conversion for every address you enter, displaying both the full 32-bit binary form and the individual octet breakdown for easy reference.
The core subnetting operation is the bitwise AND between the IP address and subnet mask. In binary AND, the result is 1 only if both bits are 1. This operation zeros out the host bits, leaving only the network address. Similarly, the bitwise OR with the inverted subnet mask produces the broadcast address by setting all host bits to 1. The calculator performs these operations instantly, but understanding them at the binary level is essential for CCNA and other networking certification exams.
Practice converting small decimal numbers to binary mentally to speed up your subnetting skills. For example, 192 in binary is 11000000, 224 is 11100000, 240 is 11110000, 248 is 11111000, 252 is 11111100, and 254 is 11111110. These are the most common non-zero octet values in subnet masks and appear frequently in network configurations. Once you recognize these patterns, you can quickly determine the prefix length just by looking at the subnet mask, without needing to convert each octet. The subnet calculator reinforces this learning by displaying both formats side by side in every result.
Common Subnetting Mistakes to Avoid
Even experienced network administrators make mistakes when designing and configuring subnets. The IP subnet calculator helps catch many of these errors before they cause network problems, but understanding the common pitfalls is the best prevention. Here are the most frequent subnetting mistakes:
- Overlapping subnets — assigning the same IP range to two different network segments. This causes routing confusion and intermittent connectivity. Always verify that your subnets are contiguous and non-overlapping, especially when using VLSM.
- Forgetting the network and broadcast addresses — trying to assign the first or last IP in a subnet to a device. The network address (all host bits 0) and broadcast address (all host bits 1) cannot be assigned to hosts, but they are counted in the total address range.
- Using /31 incorrectly — /31 subnets (255.255.255.254) provide only 2 addresses with 0 usable hosts in traditional subnetting. However, RFC 3021 allows /31 for point-to-point links by using both addresses as host addresses, eliminating the need for a network and broadcast address.
- Confusing decimal and binary notation — entering subnet masks in the wrong format or misreading CIDR notation. Always double-check that your mask notation matches what your network equipment expects.
- Not planning for growth — creating subnets that are exactly sized for current needs without room for expansion. A best practice is to leave 20-30% spare capacity in each subnet for future devices.
Final Thoughts
The IP subnet calculator is an essential tool for anyone working with computer networks, from students studying for networking certifications to experienced administrators managing large-scale enterprise infrastructure. By providing instant, accurate subnet information for both IPv4 and IPv6 addressing schemes, this calculator eliminates manual calculation errors and speeds up network design and troubleshooting significantly.
Whether you are calculating subnet masks for a home lab, planning a VLSM scheme for a corporate network, or verifying IPv6 prefix allocations, this tool gives you the information you need in a clear, organized format. The binary, hex, integer, and reverse DNS outputs are particularly valuable for advanced networking tasks like configuring access control lists, setting up reverse DNS zones, and debugging packet captures.
This IP subnet calculator is completely free to use, requires no registration, and works on all devices. Bookmark this page for quick access during your daily network administration tasks, whether you are configuring a new router, setting up a VLAN, troubleshooting a connectivity issue, or studying for a certification exam. The ability to quickly reference subnet information without manual calculation saves time and reduces configuration errors that can lead to network outages.
For complementary tools, explore our binary calculator, hex calculator, and conversion calculator to handle other number system conversions you may need in your networking work. Together, these tools provide a complete toolkit for anyone working with IP addressing, subnetting, and network infrastructure management in both IPv4 and IPv6 environments.
To learn more about ip subnet calculator, visit NOAA.