CalcStudioPro
🖥️
IT & Networking

Subnet Calculator

Calculate IPv4 subnet ranges, broadcast addresses, and host counts instantly.

DC
David Chen, CCNA, CEH
Senior Network Engineer
5 min read
Updated

Inputs

Enter in dotted decimal notation (e.g., 192.168.1.0)

Network prefix length (0-32). Example: 24 for /24 or Class C

Results

Subnet Mask
Standard dotted decimal subnet mask
Network Address
First address in the subnet
Broadcast Address
Last address in the subnet
First Usable Host
Last Usable Host
Total Hosts
Usable Hosts
CIDR Notation
Formula
Subnet Mask = (2^32 - 1) << (32 - CIDR), Network = IP & Subnet, Broadcast = Network + (2^(32-CIDR) - 1)
Request plugin

A subnet calculator is an essential tool for network administrators, IT professionals, and anyone working with IPv4 networks. It simplifies the complex process of calculating subnet masks, network ranges, usable host addresses, and broadcast addresses. Whether you are designing a network infrastructure, troubleshooting connectivity issues, or preparing for certification exams like CompTIA Network+ or Cisco CCNA, this calculator handles all the binary mathematics instantly. Simply enter your IP address and CIDR prefix to get comprehensive subnet information including total host counts, usable addresses, and network boundaries.

How it works

The subnet calculator uses bitwise operations to determine network parameters from an IP address and CIDR prefix length. The CIDR prefix (0-32) indicates how many bits define the network portion of the address. For example, a /24 prefix means the first 24 bits are the network, leaving 8 bits for hosts. The calculator converts this into a subnet mask by setting the first CIDR bits to 1 and remaining bits to 0. The network address is calculated by performing a bitwise AND between the IP and subnet mask. The broadcast address is the network address plus the total number of addresses minus one. Usable hosts are calculated by subtracting 2 from the total (one for network, one for broadcast), except in /31 point-to-point and /32 single-host scenarios.

Formula
Subnet Mask = (2^32 - 1) << (32 - CIDR), Network = IP & Subnet, Broadcast = Network + (2^(32-CIDR) - 1)
The formula calculates the subnet mask based on CIDR prefix, then applies bitwise AND to find the network address, and adds the total addresses minus one for broadcast.
💡

Worked example

For a typical home or small office network using 192.168.1.0/24, the calculator determines that the subnet mask is 255.255.255.0, covering 256 total addresses. The network address is 192.168.1.0, and the broadcast address is 192.168.1.255. Usable host addresses range from 192.168.1.1 through 192.168.1.254, providing 254 available addresses for devices. This is the standard Class C private network range, widely used for LANs where you need hundreds of device addresses.

Understanding CIDR Notation

CIDR (Classless Inter-Domain Routing) notation expresses IP addresses and subnet masks as a single unit in the format IP/prefix. The prefix number (0-32) indicates how many bits form the network portion. A /24 means the first 24 bits identify the network, leaving 8 bits for host addresses. CIDR replaced the older classful system (Class A, B, C) and allows more efficient IP allocation. Common CIDR values include /8 (16.7 million addresses), /16 (65,536 addresses), /24 (256 addresses), and /30 (4 addresses for point-to-point links). Understanding CIDR is critical for modern networking, cloud infrastructure, and routing protocols.

Subnet Mask Calculation

A subnet mask is a 32-bit number that separates the network portion of an IP address from the host portion. It uses consecutive 1s for the network bits and 0s for the host bits. For example, /25 creates the mask 255.255.255.128 because the first 25 bits are 1s and the remaining 7 bits are 0s. The calculator converts CIDR prefixes into dotted decimal notation for easier reading. Subnet masks determine how many devices can exist in a network and how routers determine packet destinations. Proper subnet masking is essential for network design, IP address planning, and configuring network interfaces on servers and routers.

Network and Broadcast Addresses

Every subnet has two special addresses. The network address is the lowest IP in the range and identifies the entire subnet. It has all host bits set to 0. The broadcast address is the highest IP in the range with all host bits set to 1. Packets sent to the broadcast address reach all devices on that subnet. These two addresses cannot be assigned to individual hosts. In a /24 subnet (192.168.1.0/24), 192.168.1.0 is the network address and 192.168.1.255 is the broadcast. This leaves 254 usable addresses for devices. Understanding these addresses prevents configuration errors and ensures proper network communication.

Usable Hosts vs Total Addresses

The total address count in a subnet equals 2 raised to the power of (32 minus CIDR). For /24, this is 2^8 = 256 addresses. However, the usable host count is always 2 less because the network and broadcast addresses are reserved. A /24 subnet has 254 usable hosts. Special cases exist: /31 subnets (point-to-point links) have 2 total addresses, both usable. /32 represents a single host with no usable additional addresses. When planning network infrastructure, always account for the network and broadcast addresses to avoid address shortages. This is why a /24 is suitable for about 250 devices, not 256.

Private IP Address Ranges

Three ranges are reserved for private use and never routed on the public internet: 10.0.0.0/8 (Class A private, 16 million addresses), 172.16.0.0/12 (Class B private, 1 million addresses), and 192.168.0.0/16 (Class C private, 65,536 addresses). The link-local range 169.254.0.0/16 is automatically assigned when DHCP fails. Loopback addresses (127.0.0.0/8) are for local testing. These ranges allow organizations to design internal networks independently while using Network Address Translation (NAT) for internet access. Understanding these ranges is fundamental to enterprise networking and security design.

Practical Applications

Network administrators use subnet calculators daily for multiple tasks: designing IP address schemes for data centers, planning WiFi networks for office buildings, configuring VLANs in enterprise switches, troubleshooting routing issues, and setting up cloud infrastructure on AWS or Azure. When deploying servers, you must understand your subnet to configure network interfaces correctly. In virtualization platforms, subnetting determines how many virtual machines can communicate directly. Security groups and firewall rules often reference subnet ranges. Certification exams test subnetting extensively because it is foundational to all networking roles. Proficiency with subnet calculations separates junior technicians from senior network engineers.

Frequently asked questions

What is the difference between /24 and /25 subnets?
/24 allocates 8 bits to hosts (256 total, 254 usable addresses). /25 allocates 7 bits to hosts (128 total, 126 usable). Smaller CIDR numbers mean larger subnets with more addresses. /25 divides a /24 subnet into two equal parts. This is useful when you need to segment networks or have fewer devices per subnet.
Can I use 192.168.1.255 as a device IP address?
No. In the 192.168.1.0/24 subnet, 192.168.1.255 is the broadcast address reserved for subnet-wide communications. Assigning it to a device causes network conflicts. Only addresses 192.168.1.1 through 192.168.1.254 are usable for hosts.
Why do /31 and /32 subnets have special rules?
/31 (255.255.255.254) subnets have 2 total addresses and are used exclusively for point-to-point links like router connections, where both addresses are usable without network/broadcast addresses. /32 represents a single host. Modern protocols (RFC 3021) allow /31 subnets for efficiency in backbone networks.
How do I choose between /24, /25, and /26 for my network?
Choose based on your device count. /24 supports 254 hosts, suitable for most departments. /25 supports 126 hosts for smaller segments or high-security zones. /26 supports 62 hosts for restricted areas. Plan for growth: choose slightly larger subnets to avoid redesigns. Consider VLAN requirements and security policies.
What are private IP addresses and why do I need them?
Private addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are reserved for internal use and never routed on the internet. They allow organizations to design networks independently. Devices using private IPs access the internet through NAT (Network Address Translation) on a router or firewall.
How does subnetting relate to routing?
Routers use subnet masks to determine if a destination IP is on the local network (direct delivery) or requires forwarding to another router. If the destination IP shares the same network bits as the local interface, the router sends the packet directly. Otherwise, it uses routing tables. Proper subnetting ensures efficient routing and network performance.
What is supernetting and how is it different from subnetting?
Subnetting divides a large network into smaller subnets using longer CIDR prefixes. Supernetting combines multiple subnets into larger blocks using shorter CIDR prefixes, reducing routing table entries. For example, combining 192.168.0.0/24 and 192.168.1.0/24 into 192.168.0.0/23 is supernetting. It improves routing efficiency in large networks.