Fast • Accurate • No Signup Required
Calculate subnet masks, network addresses, broadcast addresses, CIDR prefixes, and usable hosts instantly.
Computer networks rely on IP addressing and subnet masks to route packets accurately between physical computers, virtual machines, cloud instances, and connected appliances. Whether you are an experienced network administrator, a cybersecurity engineer designing isolated security zones, or a student preparing for Cisco CCNA or CompTIA Network+ certifications, mastering subnetting is essential. This comprehensive guide and our IPv4 Subnet Calculator give you instant answers along with the exact mathematical formulas required to understand and calculate network parameters.
An IPv4 subnet calculator is an online networking utility designed to take an IP address and a subnet mask (or CIDR prefix) and automatically compute all essential network segmentation values. Rather than requiring manual decimal-to-binary conversions and boolean bitwise math on paper, a subnet calculator provides instant, error-free results directly in your browser.
Specifically, an IPv4 subnet calculator determines:
255.255.255.192) separating the network portion from host identifiers./26).2^(32 - prefix).This tool is actively used by:
A subnet mask is a 32-bit binary number that determines where the network portion of an IPv4 address ends and where the host portion begins. Every IPv4 device uses the subnet mask to determine whether a target destination address belongs to the local subnet or must be forwarded through a default gateway router to reach an outside network.
Consider this real-world example:
In dotted-decimal format, an IPv4 address and its mask look like ordinary numbers. In reality, each of the four numbers (octets) represents an 8-bit binary number. When expressed in binary:
1s in the subnet mask specify the network identifier. For 255.255.255.0, there are 24 consecutive ones (11111111.11111111.11111111.00000000). This means all devices in this subnet share the identical prefix 192.168.1.0s represent individual client devices. With 8 host bits (00000000), this subnet can host up to 2^8 = 256 total IP addresses.
To calculate a subnet mask from a CIDR prefix, write out 32 binary bits with N ones followed by (32 - N) zeros, group them into four 8-bit octets, and convert each 8-bit binary octet into decimal. (You can also use our Binary to Decimal Converter to practice octet conversions).
Let's convert CIDR prefix /24:
What about prefixes that split an octet, such as /26? A /26 prefix has 26 ones and 6 zeros:
Here is how common CIDR prefixes map directly to IPv4 subnet masks:
/16 = 255.255.0.0/24 = 255.255.255.0/25 = 255.255.255.128/26 = 255.255.255.192/27 = 255.255.255.224/28 = 255.255.255.240/29 = 255.255.255.248/30 = 255.255.255.252/31 = 255.255.255.254 (Point-to-point links)/32 = 255.255.255.255 (Single-host routes)The network address is the base identifier of an IPv4 subnet. It is mathematically calculated by performing a bitwise logical AND operation between the 32-bit IPv4 address and the 32-bit subnet mask.
Under bitwise AND rules:
1 AND 1 = 11 AND 0 = 00 AND 1 = 00 AND 0 = 0
Because any octet ANDed with 255 (eight 1s) remains unchanged, you only need to perform binary math on the octet where the subnet boundary falls. Let's walk through an example:
The first three octets (192.168.1) are paired with 255.255.255, so they pass through unchanged. In the fourth octet, we compare 106 with 192 in binary:
Binary 01000000 equals 64 in decimal. Combining all four octets gives:
In plain English: any device configured with an IP between 192.168.1.65 and 192.168.1.126 and subnet mask 255.255.255.192 can communicate directly at Layer 2 without passing through a router.
The broadcast address is the highest numeric IP address in an IPv4 subnet block. When a host sends an IP packet to the broadcast address, switches and network interfaces deliver the frame to every device on that local subnet.
To calculate the broadcast address:
192.168.1.64).1. Alternatively, perform a bitwise OR between the Network Address and the Wildcard Mask (Network | Wildcard).
Using our 192.168.1.106/26 example:
To find how many devices can be assigned IP addresses in any standard IPv4 subnet, follow this universal formula:
For a standard /24 subnet (subnet mask 255.255.255.0):
32 - 24 = 82^8 = 256256 - 2 = 254Why do we subtract 2? In standard IPv4 networks, two addresses are permanently reserved:
Here are common subnet sizes and their usable host counts:
/24 = 256 - 2 = 254 usable hosts/25 = 128 - 2 = 126 usable hosts/26 = 64 - 2 = 62 usable hosts/27 = 32 - 2 = 30 usable hosts/28 = 16 - 2 = 14 usable hosts/29 = 8 - 2 = 6 usable hosts/30 = 4 - 2 = 2 usable hosts (traditionally used for router-to-router point-to-point links)2^H - 2 formula to /31 or /32 subnets! Under RFC 3021, /31 subnets have 2 usable hosts without separate network or broadcast reservations. A /32 represents a single host route with 1 IP address.
A /32 subnet mask corresponds to 255.255.255.255 in dotted-decimal notation. It has exactly 32 network bits and 0 host bits.
Because there are zero host bits, a /32 does not represent a traditional multi-device network. Instead, it identifies a single, unique IPv4 address:
Where is a /32 subnet mask used?
/32 IP to virtual loopback interfaces (e.g., Loopback0 in Cisco IOS or Juniper Junos). Since loopbacks never go down as long as the router has power, OSPF and BGP use the /32 loopback as their stable Router ID (RID)./32 host route that directs traffic for one specific destination server over an explicit path./32 rule restricts traffic to one precise server rather than an entire subnet range./32 client addresses to remote road-warrior connections.Comparison of small subnets:
| CIDR | Subnet Mask | Host Bits | Total Addresses | Usable Hosts | Primary Use Case |
|---|---|---|---|---|---|
| /30 | 255.255.255.252 |
2 | 4 | 2 | Legacy point-to-point router links |
| /31 | 255.255.255.254 |
1 | 2 | 2 | Modern point-to-point links (RFC 3021) |
| /32 | 255.255.255.255 |
0 | 1 | 1 | Loopback interfaces, single host routes, firewall rules |
Below is a complete reference table for IPv4 subnet masks from /16 through /32. It includes the dotted-decimal subnet mask, wildcard mask, host bits, total block size, and usable host count.
| CIDR | Subnet Mask | Wildcard Mask | Host Bits | Total Addresses | Usable Hosts |
|---|---|---|---|---|---|
| /16 | 255.255.0.0 |
0.0.255.255 |
16 | 65,536 | 65,534 |
| /17 | 255.255.128.0 |
0.0.127.255 |
15 | 32,768 | 32,766 |
| /18 | 255.255.192.0 |
0.0.63.255 |
14 | 16,384 | 16,382 |
| /19 | 255.255.224.0 |
0.0.31.255 |
13 | 8,192 | 8,190 |
| /20 | 255.255.240.0 |
0.0.15.255 |
12 | 4,096 | 4,094 |
| /21 | 255.255.248.0 |
0.0.7.255 |
11 | 2,048 | 2,046 |
| /22 | 255.255.252.0 |
0.0.3.255 |
10 | 1,024 | 1,022 |
| /23 | 255.255.254.0 |
0.0.1.255 |
9 | 512 | 510 |
| /24 | 255.255.255.0 |
0.0.0.255 |
8 | 256 | 254 |
| /25 | 255.255.255.128 |
0.0.0.127 |
7 | 128 | 126 |
| /26 | 255.255.255.192 |
0.0.0.63 |
6 | 64 | 62 |
| /27 | 255.255.255.224 |
0.0.0.31 |
5 | 32 | 30 |
| /28 | 255.255.255.240 |
0.0.0.15 |
4 | 16 | 14 |
| /29 | 255.255.255.248 |
0.0.0.7 |
3 | 8 | 6 |
| /30 | 255.255.255.252 |
0.0.0.3 |
2 | 4 | 2 |
| /31 | 255.255.255.254 |
0.0.0.1 |
1 | 2 | 2 (RFC 3021) |
| /32 | 255.255.255.255 |
0.0.0.0 |
0 | 1 | 1 (Host Route) |
Below are four concrete, practical calculations showing how different prefix lengths behave in real enterprise networks.
Configuration: 192.168.1.106/24 (Subnet Mask: 255.255.255.0)
Configuration: 192.168.1.106/26 (Subnet Mask: 255.255.255.192)
Configuration: 192.168.1.10/30 (Subnet Mask: 255.255.255.252)
Configuration: 192.168.1.10/32 (Subnet Mask: 255.255.255.255)
CIDR stands for Classless Inter-Domain Routing. Introduced in 1993 by the Internet Engineering Task Force (IETF) under RFC 1519, CIDR replaced the rigid legacy classful architecture (Class A, B, and C) that was exhausting IPv4 address space at an alarming rate.
Instead of constraining organizations to rigid blocks of 16 million addresses (Class A) or 65,536 addresses (Class B), CIDR allows network administrators to specify any arbitrary prefix length by appending a slash (/) and the count of network bits.
Let's deconstruct 192.168.1.0/24:
192.168.1.0 represents the network address./24 indicates that the first 24 bits are fixed for the network.32 - 24 = 8) are available for assigning host addresses.Common CIDR blocks in real-world infrastructure:
/8: 16,777,216 total IPs (e.g., private block 10.0.0.0/8)./16: 65,536 total IPs (typical large enterprise cloud VPC, e.g., AWS VPC 172.16.0.0/16)./24: 256 total IPs (standard branch office LAN or cloud subnet, e.g., 192.168.1.0/24)./26: 64 total IPs (medium cloud subnet for database or web tiers)./30: 4 total IPs (inter-router interconnect link)./32: 1 single host address.
A /24 subnet contains exactly 254 usable hosts. The total block size is 256 addresses (2^8 = 256), with the first address reserved as the network address and the last address reserved as the broadcast address (256 - 2 = 254).
A /26 subnet contains exactly 62 usable hosts. The total block size is 64 addresses (2^6 = 64). Subtracting 2 for the network and broadcast addresses leaves 62 assignable IP addresses.
The subnet mask for /26 is 255.255.255.192. In binary, the fourth octet contains two 1s (11000000), which equals 128 + 64 = 192.
The subnet mask for /32 is 255.255.255.255. All 32 bits are binary 1s, leaving 0 host bits and representing a single specific IPv4 address.
A /28 subnet has 16 total IP addresses and 14 usable hosts. The host bits are 32 - 28 = 4, resulting in 2^4 = 16 total addresses and 16 - 2 = 14 usable endpoints.
Convert the IP address and subnet mask to binary and perform a bitwise logical AND operation. Wherever both the IP bit and mask bit are 1, the resulting bit is 1; otherwise, it is 0. The resulting binary value converted back to decimal is the network address.