IP Subnet Calculator

Subnetting is one of those networking fundamentals that every developer and system administrator needs to understand, yet the binary math involved makes it easy to make mistakes when calculating by hand.

This subnet calculator takes an IP address and a subnet mask (or CIDR prefix length) and instantly returns the network address, broadcast address, usable host range, total number of hosts, and the wildcard mask.

Enter any IPv4 address with a CIDR prefix like 192.168.1.0/24 or provide the subnet mask in dotted decimal notation, and the tool breaks down the network into every detail you need. You can see which bits belong to the network portion and which belong to the host portion, making it straightforward to plan address allocations, verify firewall rules, or troubleshoot connectivity issues.

Whether you are designing a new network topology, splitting a larger network into smaller subnets for different departments, configuring access control lists, or studying for a networking certification, this tool handles the binary arithmetic so you can focus on the design decisions that matter.

What Is Subnetting?

Subnetting is the practice of dividing a single IP network into smaller, more manageable segments called subnets. Every device on a TCP/IP network has an IP address and a subnet mask. Together, these two values determine which portion of the address identifies the network and which portion identifies the specific host on that network.

Without subnetting, an organization with a Class B address (a /16 network) would have a single flat network containing up to 65,534 hosts. Every broadcast would reach all 65,534 devices, every ARP request would flood the entire network, and security boundaries would be nonexistent. Subnetting solves these problems by creating smaller broadcast domains, improving network performance, enabling security segmentation, and making IP address management more efficient.

The subnet mask is the key to subnetting. It is a 32-bit value where the leading bits are set to 1 (representing the network portion) and the trailing bits are set to 0 (representing the host portion). A subnet mask of 255.255.255.0 in binary is 11111111.11111111.11111111.00000000, which means the first 24 bits identify the network and the last 8 bits identify the host. This is written in CIDR notation as /24.

CIDR Notation Explained

Classless Inter-Domain Routing (CIDR) notation is the modern standard for expressing IP addresses and their associated subnet masks. It appends a forward slash and a number to the IP address, where the number indicates how many bits of the address belong to the network portion.

For example, 10.0.0.0/8 means the first 8 bits (the entire first octet) identify the network, leaving 24 bits for host addresses. This provides over 16 million possible host addresses. Conversely, 10.0.0.0/30 means 30 bits are used for the network, leaving only 2 bits for hosts, which yields exactly 4 addresses (2 usable, since the network and broadcast addresses are reserved).

Common CIDR prefix lengths and their corresponding subnet masks:

  • /8 = 255.0.0.0 (16,777,214 hosts)
  • /16 = 255.255.0.0 (65,534 hosts)
  • /24 = 255.255.255.0 (254 hosts)
  • /25 = 255.255.255.128 (126 hosts)
  • /26 = 255.255.255.192 (62 hosts)
  • /27 = 255.255.255.224 (30 hosts)
  • /28 = 255.255.255.240 (14 hosts)
  • /29 = 255.255.255.248 (6 hosts)
  • /30 = 255.255.255.252 (2 hosts)
  • /32 = 255.255.255.255 (1 host, used for host routes)

CIDR replaced the older classful addressing system (Class A, B, C) in the 1990s because classful allocation was extremely wasteful. An organization that needed 300 addresses would receive a Class B with 65,534 addresses, wasting over 65,000. CIDR allows allocation in any power-of-two block size, dramatically improving address utilization.

Key Subnet Calculations

When you enter an IP address and prefix length into this calculator, it computes several values that are essential for network planning and troubleshooting.

Network Address. This is the first address in the subnet and identifies the network itself. It is calculated by performing a bitwise AND between the IP address and the subnet mask. No host can use this address. For 192.168.1.100/24, the network address is 192.168.1.0.

Broadcast Address. This is the last address in the subnet, used to send a packet to all hosts on the network. It is calculated by setting all host bits to 1. For 192.168.1.0/24, the broadcast address is 192.168.1.255. No host can use this address either.

First Usable Host. The network address plus 1. For 192.168.1.0/24, this is 192.168.1.1. This address is commonly assigned to the default gateway (router).

Last Usable Host. The broadcast address minus 1. For 192.168.1.0/24, this is 192.168.1.254.

Number of Usable Hosts. Calculated as 2^(32 – prefix length) – 2. The subtraction of 2 accounts for the network and broadcast addresses. A /24 network has 2^8 – 2 = 254 usable hosts. A /30 has 2^2 – 2 = 2 usable hosts, which is why /30 subnets are standard for point-to-point links between routers.

Wildcard Mask. The bitwise inverse of the subnet mask. It is used in access control lists (ACLs) on Cisco routers and in OSPF area configurations. For a /24 subnet (mask 255.255.255.0), the wildcard mask is 0.0.0.255.

How to Subnet a Network

Suppose your organization has been allocated the 10.10.0.0/16 network and you need to create subnets for four departments, each requiring up to 200 hosts.

Step 1: Determine the required subnet size. Each department needs 200 hosts. The smallest subnet that accommodates 200 hosts is a /24 (254 usable hosts). A /25 only provides 126, which is not enough.

Step 2: Allocate subnets from the available address space. Starting from 10.10.0.0/16, you can carve out /24 subnets:

  • Department A: 10.10.1.0/24 (hosts 10.10.1.1 through 10.10.1.254)
  • Department B: 10.10.2.0/24 (hosts 10.10.2.1 through 10.10.2.254)
  • Department C: 10.10.3.0/24 (hosts 10.10.3.1 through 10.10.3.254)
  • Department D: 10.10.4.0/24 (hosts 10.10.4.1 through 10.10.4.254)

Step 3: Allocate subnets for point-to-point links between routers. These only need 2 hosts, so /30 subnets are ideal: 10.10.0.0/30, 10.10.0.4/30, 10.10.0.8/30, etc.

This leaves the rest of the 10.10.0.0/16 space available for future growth. Good subnet planning always reserves room for expansion.

Variable Length Subnet Masking (VLSM)

VLSM is the practice of using different subnet mask lengths within the same network, and it is the standard approach in modern network design. Without VLSM, every subnet in a network must use the same mask, leading to massive address waste.

Consider a network with these requirements: one department needs 100 hosts, another needs 50, a third needs 20, and you have several point-to-point router links. Without VLSM, you would need to use a /25 mask everywhere (the smallest that fits 100 hosts), wasting addresses in the smaller subnets. With VLSM, you assign each subnet the mask that best fits its size:

  • 100-host department: /25 (126 usable hosts)
  • 50-host department: /26 (62 usable hosts)
  • 20-host department: /27 (30 usable hosts)
  • Point-to-point links: /30 (2 usable hosts each)

This efficient allocation is only possible with VLSM and is why understanding different prefix lengths matters. This calculator helps you experiment with different mask lengths to find the optimal fit for each segment.

Private IP Address Ranges

Three blocks of IPv4 address space are reserved for private use, meaning they are not routable on the public internet. These are the addresses used inside virtually every home and corporate network.

  • 10.0.0.0/8 (10.0.0.0 to 10.255.255.255) — Over 16 million addresses. Commonly used in large enterprise networks.
  • 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) — Over 1 million addresses. Used in medium-sized organizations and cloud provider VPCs.
  • 192.168.0.0/16 (192.168.0.0 to 192.168.255.255) — Over 65,000 addresses. The most familiar range, used in home networks and small offices.

Devices using private addresses access the internet through Network Address Translation (NAT), which maps private addresses to one or more public addresses. When planning your network, always use private addresses internally and reserve public addresses for internet-facing services.

Additional reserved ranges include 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local), and 100.64.0.0/10 (carrier-grade NAT). Understanding these ranges helps avoid address conflicts and misconfigurations.

Subnetting in Cloud Environments

Cloud platforms use subnetting extensively in their virtual networking constructs. Understanding subnet sizing is critical when designing VPCs and virtual networks.

In AWS, a VPC is defined with a CIDR block (e.g., 10.0.0.0/16), and you create subnets within it. AWS reserves 5 addresses in every subnet: the network address, the VPC router address (first usable + 1), the DNS server address, a reserved-for-future-use address, and the broadcast address. So a /24 subnet in AWS provides 251 usable addresses, not 254.

Azure and Google Cloud have similar reservations. When sizing subnets in the cloud, always account for provider-reserved addresses, load balancer addresses, and growth headroom. A common mistake is creating subnets that are too small, which requires painful migration when they fill up.

For cloud network design, use CIDR blocks that allow easy expansion. Start with a /16 VPC and create /24 subnets for most workloads. This gives you 256 possible subnets with 251 usable hosts each, which accommodates most applications comfortably.

Use our JSON Formatter for working with cloud infrastructure configurations and our Base64 Encoder/Decoder for encoding network credentials.

Frequently Asked Questions

What is the difference between a subnet mask and CIDR notation?

They express the same information in different formats. A subnet mask of 255.255.255.0 is equivalent to /24 in CIDR notation. Both indicate that the first 24 bits of the address identify the network. CIDR notation is shorter and more commonly used in modern networking.

How many usable hosts does a /24 subnet have?

A /24 subnet has 254 usable host addresses. The total number of addresses is 256 (2^8), but two are reserved: the network address (first) and the broadcast address (last). The usable range spans from the network address plus 1 to the broadcast address minus 1.

What is a /30 subnet used for?

A /30 subnet provides exactly 2 usable host addresses, making it ideal for point-to-point links between two routers. Each router gets one address. Using a larger subnet for a two-device link wastes addresses.

What is the network address and can I assign it to a device?

The network address is the first address in a subnet (all host bits set to 0). It identifies the network itself and cannot be assigned to any device. For 192.168.1.0/24, the network address is 192.168.1.0.

What is a wildcard mask?

A wildcard mask is the bitwise inverse of a subnet mask. Where the subnet mask has a 1, the wildcard mask has a 0, and vice versa. For a /24 subnet (mask 255.255.255.0), the wildcard mask is 0.0.0.255. Wildcard masks are used in Cisco ACLs and OSPF configurations.

Can I have overlapping subnets?

No. Overlapping subnets cause routing ambiguity and unpredictable behavior. If 10.0.1.0/24 and 10.0.0.0/23 are both configured on the same network, any address in the 10.0.1.x range belongs to both, creating conflicts. Always verify that new subnets do not overlap existing allocations.

What is the maximum number of subnets I can create from a /16 network?

It depends on the subnet size. A /16 network can be divided into 256 /24 subnets, 512 /25 subnets, 1024 /26 subnets, and so on. In general, you can create 2^(new prefix – original prefix) subnets. From a /16, creating /24 subnets gives 2^(24-16) = 256.

Data accurate as of: March 2026