Free Network Planning Tool

Subnet Calculator
Free IP Range & Mask Calculator

Use our free subnet calculator to instantly find the network address, broadcast address, usable host range, and wildcard mask for any IPv4 address. Enter an IP like 192.168.1.1/24 and get the subnet mask, usable hosts, IP class, and binary mask in seconds.

Quick Answer: What Is a Subnet Calculator?

A subnet calculator takes an IPv4 address and CIDR prefix (like 192.168.1.0/24) and computes the network address, broadcast address, usable host range, subnet mask, and wildcard mask using binary ANDing. A /24 provides 254 usable hosts, a /16 provides 65,534, and a /8 provides 16,777,214. This tool helps network engineers, cloud architects, and CCNA students plan efficient IP allocations without manual binary math.

Robert Harrison, OSINT and Network Utility Expert at TrustMyIP
Written & Verified By

Robert Harrison

OSINT & Network Utility Expert

Robert specializes in network architecture, CIDR subnetting, and IP address management. He helps network engineers and cloud architects plan efficient, non-overlapping IP allocations for production environments.

View All Articles by Robert Harrison

What Is a Subnet Calculator and Why Every Network Engineer Needs One

A subnet calculator is a tool that performs the binary math required to divide an IP network into smaller, manageable segments called subnets. When you enter an IPv4 address like 192.168.1.1 and select a CIDR prefix such as /24, the ip subnet calculator computes the network address, broadcast address, usable host range, subnet mask, and wildcard mask instantly. Without this tool, engineers would need to convert every IP address to binary and perform manual ANDing operations — a process that takes minutes per calculation and is prone to human error.

Subnetting is fundamental to how the internet works. Every device connected to a network needs a unique IP address, and every network needs clear boundaries so routers know where to forward packets. Our subnet mask calculator handles this complexity automatically. Whether you are planning a corporate network with thousands of devices, configuring a CIDR block for cloud infrastructure, or studying for your CCNA certification, this tool gives you instant, accurate results for every subnet from /1 to /32.

Engineering Note: This subnet calculator uses server-side PHP bitwise operations for maximum accuracy. All calculations happen on the server — no JavaScript rounding errors, no floating-point issues, and results verified against RFC 1918 and RFC 4632 standards.

How Subnetting Works: The Binary ANDing Process Explained

At the core of every subnet calculator, there is one fundamental operation: the bitwise AND. When you enter an IP address and a subnet mask, the calculator converts both to 32-bit binary numbers and compares them bit by bit. If both bits are 1, the result is 1. If either bit is 0, the result is 0. The output of this operation is the network address — the first address in your subnet and the identity of your entire network segment.

Step-by-Step Calculation for 192.168.1.55/24

# Step 1: Convert the IP address to binary

192.168.1.55 = 11000000.10101000.00000001.00110111

# Step 2: Create the subnet mask from /24

/24 mask = 11111111.11111111.11111111.00000000 (255.255.255.0)

# Step 3: Bitwise AND to find the network address

Network = 11000000.10101000.00000001.00000000

= 192.168.1.0

# Step 4: Invert the mask to find the broadcast address

Broadcast = 11000000.10101000.00000001.11111111

= 192.168.1.255

This is why our ip subnet calculator works correctly even when you enter a host IP instead of the network address. The bitwise AND operation always finds the true network start. For IP-to-binary conversion practice, use our IP to Binary Converter.

Easy Memory Trick: For every bit you remove from the prefix, you double the number of hosts. Going from /25 (126 hosts) to /24 (254 hosts) doubles the size. Going from /24 to /23 (510 hosts) doubles it again.

Complete Subnet Cheat Sheet: Every Prefix from /32 to /8

This subnet cheat sheet shows every common CIDR prefix, the matching subnet mask, how many total IPs and usable hosts each block contains, and the typical use case for each size.

CIDRSubnet MaskTotal IPsUsable HostsTypical Use
/32255.255.255.25511Single host, loopback
/31255.255.255.25422Point-to-point link (RFC 3021)
/30255.255.255.25242WAN link between routers
/28255.255.255.2401614Small office, IoT devices
/24255.255.255.0256254Most common — home, SMB
/22255.255.252.01,0241,022Medium enterprise campus
/20255.255.240.04,0964,094Data center floor
/16255.255.0.065,53665,534AWS VPC, large ISP allocation
/8255.0.0.016.7M16.7MClass A block (10.0.0.0/8)

For detailed CIDR breakdowns beyond this table, use our dedicated CIDR Calculator Tool which converts any CIDR notation to full IP ranges.

Usable Hosts: The "Subtract 2" Rule and Cloud Provider Exceptions

You will notice our subnet calculator shows two numbers: total IPs and usable hosts. The difference is always 2 (except for /31 and /32 special cases). Here is why:

Two Reserved Addresses in Every Subnet

  • Network Address (first IP): This identifies the subnet itself. Devices use it for routing decisions. You cannot assign it to a host. Example: in 192.168.1.0/24, the network address is 192.168.1.0.
  • Broadcast Address (last IP): This address sends data to every device in the subnet simultaneously. Example: in 192.168.1.0/24, the broadcast address is 192.168.1.255.

The Usable Hosts Formula

The formula is: Usable Hosts = 2^(32 - prefix) - 2. For a /24: 2^8 = 256 total, minus 2 = 254 usable hosts. For a /16: 2^16 = 65,536 total, minus 2 = 65,534 usable hosts. For a /30 point-to-point link, you get exactly 2 usable addresses — perfect for a WAN connection between two routers.

AWS VPC Warning: Amazon Web Services reserves 5 IP addresses per subnet, not 2. These are: the network address (.0), VPC router (.1), DNS server (.2), reserved for future use (.3), and broadcast (.255). A /24 subnet in AWS gives you only 251 usable hosts, not 254. Azure and Google Cloud have similar reservations. Always verify with a subnet calculator before deploying cloud infrastructure.

VLSM Subnetting: Variable Length Subnet Masks Explained

VLSM (Variable Length Subnet Masking) is the modern standard for subnetting that allows different-sized subnets within the same network. Unlike FLSM (Fixed Length Subnet Masking) where every subnet is identical, VLSM lets you assign exactly the right number of addresses to each segment — eliminating IP waste and maximizing efficiency.

VLSM vs FLSM: Why Variable Masks Win

Imagine you have the network 192.168.1.0/24 and need three subnets: one for 100 users, one for 50, and one WAN link with 2 devices. With FLSM, you would divide into four equal /26 subnets of 62 hosts each. The 100-user subnet would not fit at all, and the WAN link would waste 60 addresses. With VLSM, you assign a /25 (126 hosts) for the large office, a /26 (62 hosts) for the medium office, and a /30 (2 hosts) for the WAN link.

# VLSM allocation for 192.168.1.0/24

Subnet 1: 192.168.1.0/25 = 126 usable hosts (Large Office)

Subnet 2: 192.168.1.128/26 = 62 usable hosts (Medium Office)

Subnet 3: 192.168.1.192/30 = 2 usable hosts (WAN Link)

# Remaining: 192.168.1.196 - 192.168.1.255 (available for growth)

VLSM Rule: Always start with the largest subnet first and work downward. If you start with the smallest, you risk overlapping address spaces when assigning larger blocks later. Use our subnet calculator to verify each allocation before configuring your routers.

VLSM is a required skill for the CCNA certification and is the standard method used in enterprise networks, ISP deployments, and cloud infrastructure. Every modern routing protocol (OSPF, EIGRP, BGP) supports VLSM.

From Classful to Classless: How CIDR Replaced the Old System

Before 1993, IP addresses were assigned in rigid "classes" that caused massive waste. If a company needed 300 addresses, they had to take a Class B block with 65,536 addresses — throwing away over 65,000 IPs. This wasteful system was the primary driver of IPv4 address exhaustion.

ClassDefault MaskHostsProblem
Class A (/8)255.0.0.016.7 millionWay too large for most organizations
Class B (/16)255.255.0.065,534Still too large, wasted IPs
Class C (/24)255.255.255.0254Often too small for growing companies

A company needing 500 IP addresses had to buy a Class B with 65,534 IPs — wasting over 65,000 addresses. CIDR (Classless Inter-Domain Routing), introduced in 1993, solved this by letting you use any prefix length. A /23 gives exactly 510 usable hosts — perfect for that 500-device company. This flexibility is what keeps the IPv4 internet running while the world transitions to IPv6 addressing.

Private IP Address Ranges: RFC 1918 Blocks for Internal Networks

RFC 1918 defines three private IP ranges reserved for internal use. These addresses are not routable on the public internet and must be translated using NAT (Network Address Translation) to communicate externally. Every subnet calculator should identify whether an address falls within these private ranges — our tool does this automatically.

CIDR BlockRangeTotal IPsTypical Use
10.0.0.0/810.0.0.0 - 10.255.255.25516,777,216Large enterprise, AWS VPC
172.16.0.0/12172.16.0.0 - 172.31.255.2551,048,576Medium business, Docker
192.168.0.0/16192.168.0.0 - 192.168.255.25565,536Home networks, small office

When you enter a private IP into our subnet calculator, the results show "Private (RFC 1918)" in the address type field. This helps verify that your internal subnets are using the correct reserved ranges. To check if an IP has been flagged on security databases, use our IP Blacklist Checker.

Subnet Planning for AWS VPC, Azure, and Google Cloud

Cloud infrastructure runs on subnetting. When you create a Virtual Private Cloud (VPC) in AWS, Azure, or Google Cloud, the very first decision is selecting a CIDR block. Getting this wrong can force costly network redesigns later.

AWS VPC Subnet Architecture

  • VPC Foundation: Use 10.0.0.0/16 — this gives you 65,534 usable IPs to subnet into tiers
  • Web Tier: 10.0.1.0/24 — 251 hosts (after AWS reserves 5)
  • App Tier: 10.0.2.0/24 — separate subnet for application servers
  • Database Tier: 10.0.3.0/24 — private subnet with no internet access

Avoiding CIDR Overlap

The most common cloud networking mistake is using overlapping CIDR blocks between VPCs. If VPC-A uses 10.0.0.0/16 and VPC-B also uses 10.0.0.0/16, you cannot peer them. Use our subnet calculator to verify that every VPC uses a unique, non-overlapping range. A common strategy is: Production = 10.0.0.0/16, Staging = 10.1.0.0/16, Development = 10.2.0.0/16.

For verifying your cloud IP configurations, combine this tool with our Cloud IP Detection Tool and DNS Lookup for complete infrastructure auditing.

Subnetting as a Security Perimeter: Network Segmentation Guide

Subnetting is one of the most effective ways to implement network security. By creating logical boundaries between departments, device types, and security zones, you control exactly which devices can communicate with each other. This is the foundation of the Zero Trust architecture model.

Broadcast Domain Reduction

Large flat networks suffer from broadcast storms where devices constantly send ARP requests and discovery packets. In a /16 network with 65,000 devices, every broadcast reaches all 65,000 hosts. Dividing into /24 subnets limits broadcasts to 254 devices each, dramatically improving network performance and reducing attack surface.

Department-Based Segmentation Example

# Enterprise subnet segmentation plan

10.0.1.0/24 = Management (executive devices)

10.0.2.0/24 = Engineering (developer workstations)

10.0.3.0/24 = Guest Wi-Fi (isolated, no internal access)

10.0.10.0/24 = Database servers (restricted ACL)

10.0.20.0/24 = VOIP phones (QoS priority)

# Firewall rules enforce inter-subnet traffic policies

In a flat network, if a hacker compromises a guest laptop, they can immediately scan every device — including your database servers. With proper subnet isolation, the attacker is trapped within the guest subnet and cannot reach the database subnet without passing through a monitored firewall. For checking if your public-facing IP has been compromised, run it through our IP Fraud Score Checker and Tor Exit Node Detector.

Wildcard Mask Explained: The Inverse of the Subnet Mask

A wildcard mask is the bitwise inverse of a subnet mask. Where the subnet mask has a 1, the wildcard has a 0, and vice versa. For a /24 subnet (255.255.255.0), the wildcard mask is 0.0.0.255. Our wildcard mask calculator computes this automatically for every prefix.

Wildcard Mask Calculation

  • /24 Subnet Mask: 255.255.255.0 → Wildcard: 0.0.0.255
  • /16 Subnet Mask: 255.255.0.0 → Wildcard: 0.0.255.255
  • /28 Subnet Mask: 255.255.255.240 → Wildcard: 0.0.0.15

Where Wildcard Masks Are Used

  • Cisco ACLs (Access Control Lists): Cisco routers use wildcard masks instead of subnet masks in ACL rules to define which IPs are permitted or denied.
  • OSPF Routing: When configuring OSPF network statements, you specify the wildcard mask to define which interfaces participate.
  • Firewall Rules: Some firewall vendors use wildcard masks for more flexible IP matching than standard subnet masks allow.

# Cisco ACL using wildcard mask

access-list 101 permit ip 192.168.1.0 0.0.0.255 any

# This permits all traffic from 192.168.1.0/24

# The wildcard 0.0.0.255 means: match first 3 octets, ignore last

# OSPF network statement

router ospf 1

network 10.0.0.0 0.0.255.255 area 0

Our subnet calculator automatically calculates the wildcard mask for every CIDR block you enter. For verifying how your firewall handles these rules, check open ports using our Open Port Scanner Tool.

Supernetting and Route Aggregation: Reducing Routing Table Size

Supernetting is the reverse of subnetting — instead of dividing a network into smaller pieces, you combine multiple small networks into one larger block. This is also called route aggregation or route summarization, and it is essential for keeping internet routing tables manageable.

# Four separate /24 blocks:

192.168.0.0/24 (192.168.0.0 - 192.168.0.255)

192.168.1.0/24 (192.168.1.0 - 192.168.1.255)

192.168.2.0/24 (192.168.2.0 - 192.168.2.255)

192.168.3.0/24 (192.168.3.0 - 192.168.3.255)

# Combined into one /22 supernet:

192.168.0.0/22 (192.168.0.0 - 192.168.3.255)

# 4 routing entries → 1 routing entry

ISPs use supernetting extensively to keep global routing tables manageable. Supernetting only works with contiguous blocks that align on binary boundaries. You cannot supernet 192.168.1.0/24 and 192.168.3.0/24 because they are not contiguous. Use our subnet calculator to verify block boundaries before attempting route aggregation. For ASN and routing information, check our ASN Lookup Tool.

Best Subnet for Home Network: Practical Setup Guide

For most home networks, the default 192.168.1.0/24 subnet works perfectly. It provides 254 usable addresses — more than enough for computers, phones, tablets, smart TVs, IoT devices, and security cameras. Your router typically assigns itself 192.168.1.1 as the gateway and uses DHCP to distribute addresses from a configured range.

When to Subnet Your Home Network

If you run a home lab, work from home, or have extensive IoT devices, creating separate subnets adds security and organization. Use 192.168.1.0/24 for trusted personal devices and 192.168.2.0/24 for IoT devices like smart plugs and cameras. This prevents a compromised IoT device from accessing your work laptop. Many advanced home routers and firewalls (pfSense, Ubiquiti, MikroTik) support multiple VLANs with separate subnets.

To verify your home router is not leaking information, run our Browser Leak Test and check your WebRTC Leak Status.

Developer Integration: Subnet Calculation in Code

For developers who need to perform subnet calculations programmatically, here are ready-to-use implementations in PHP and Python. Both use the same bitwise AND logic as our online subnet calculator.

# PHP: Calculate subnet from IP and CIDR

$ip = ip2long('192.168.1.55');

$cidr = 24;

$mask = ~((1 << (32 - $cidr)) - 1);

$network = long2ip($ip & $mask);

$broadcast = long2ip(($ip & $mask) | ~$mask);

echo "Network: $network, Broadcast: $broadcast";

# Python: Calculate subnet using ipaddress module

import ipaddress

net = ipaddress.ip_network('192.168.1.0/24', strict=False)

print(f"Network: {net.network_address}")

print(f"Broadcast: {net.broadcast_address}")

print(f"Usable: {list(net.hosts())[0]} - {list(net.hosts())[-1]}")

For verifying DNS resolution and reverse lookups within your subnets, combine these scripts with our Reverse DNS Lookup and WHOIS Domain Lookup tools.

Frequently Asked Questions About Subnetting

What is a subnet calculator and how does it work?

A subnet calculator takes an IPv4 address and a CIDR prefix (like /24) and performs bitwise AND operations to compute the network address, broadcast address, usable host range, subnet mask, and wildcard mask. It automates the binary math that would take minutes by hand.

How many usable hosts are in a /24 subnet?

A /24 has 256 total IPs. Subtract 2 for the network address and broadcast address, giving you 254 usable hosts. The formula is 2^(32-24) - 2 = 254. In AWS, the number drops to 251 due to 5 reserved addresses.

What is the difference between FLSM and VLSM?

FLSM uses the same subnet mask for every subnet, creating equal segments. VLSM allows different masks for different subnets, matching each segment's actual need. VLSM is more efficient and is the standard in modern networking.

What is a subnet mask and why does it matter?

A subnet mask is a 32-bit number that separates the network portion from the host portion. For example, 255.255.255.0 (/24) means the first 24 bits identify the network and the last 8 bits identify hosts. Routers use it to determine if traffic stays local or gets forwarded.

What is a wildcard mask used for?

A wildcard mask is the inverse of the subnet mask. For /24, the wildcard is 0.0.0.255. It is primarily used in Cisco ACLs and OSPF routing to specify which IP bits to inspect during packet filtering and route advertisements.

How do I plan subnets for AWS VPC?

Use 10.0.0.0/16 for your main VPC (65,534 usable IPs). Then divide into /24 subnets for each tier. AWS reserves 5 IPs per subnet, so a /24 gives 251 usable hosts. Leave gap space between subnets for future expansion.

What is CIDR notation and how does it relate to subnetting?

CIDR notation uses a slash followed by the number of network bits (like /24). It replaced the old Class A/B/C system and allows flexible subnet sizes. /24 equals 255.255.255.0, /16 equals 255.255.0.0. For detailed analysis, use our CIDR Calculator.

Why can't I assign the first and last IP in a subnet?

The first IP is the network address, used by routers to identify the subnet. The last IP is the broadcast address, used to send data to all devices simultaneously. Assigning either to a device breaks routing logic. The only exception is /31 subnets (RFC 3021) for point-to-point links.

Related Network Planning Tools

Complete your network architecture with our free toolkit.

Calculate Your Subnet Now
Free IP Range & Mask Calculator

Find the network address, broadcast address, usable hosts, and wildcard mask for any IPv4 address. Our free subnet calculator works instantly — perfect for AWS VPC planning, VLSM subnetting, and network architecture.