Subnet Calculator | CIDR & Network Address Tool

Calculate subnet masks, CIDR notation, usable host ranges, broadcast addresses, and wildcard masks for any IPv4 address. Plan network segments and troubleshoot IP configurations instantly in your browser.

Subnet Calculator Inputs

IP Address & Subnet

IP Address:
CIDR Prefix / Subnet Mask:

Understanding Subnetting and CIDR Notation

Subnetting divides a larger IP network into smaller, more manageable segments called subnets. Each subnet operates as an independent network with its own range of IP addresses, network address, and broadcast address. Network administrators use subnetting to improve security by isolating departments, reduce broadcast traffic, and optimize IP address allocation across an organization's infrastructure.

Key Subnetting Concepts

Subnet Mask: A 32-bit number that separates the network portion from the host portion of an IP address. Common masks include 255.255.255.0 (/24) for 254 usable hosts and 255.255.0.0 (/16) for 65,534 usable hosts. The mask determines which bits represent the network and which represent individual hosts.

CIDR Notation: Classless Inter-Domain Routing replaced the old classful system (Class A, B, C) with a flexible prefix length. Written as an IP address followed by a slash and the number of network bits (e.g., 192.168.1.0/24). CIDR allows networks of any size rather than fixed Class A, B, or C boundaries.

Network Address: The first address in a subnet, calculated by performing a bitwise AND between the IP address and subnet mask. This address identifies the subnet itself and cannot be assigned to a host device. Routers use network addresses to determine where to forward packets.

Broadcast Address: The last address in a subnet, where all host bits are set to 1. Packets sent to this address reach every device on the subnet. Like the network address, the broadcast address cannot be assigned to an individual host.

How Subnet Masks Work

A subnet mask uses consecutive 1-bits to mark the network portion and consecutive 0-bits to mark the host portion. For example, 255.255.255.0 in binary is 11111111.11111111.11111111.00000000, meaning the first 24 bits identify the network and the last 8 bits identify hosts within that network. This gives 2^8 = 256 total addresses, of which 254 are usable for host devices after removing the network and broadcast addresses.

Increasing the prefix length (using more network bits) creates smaller subnets with fewer hosts. A /25 splits a /24 into two subnets of 128 addresses each. A /26 creates four subnets of 64 addresses. Network planners balance subnet size against the number of required hosts, allocating only as many addresses as each network segment needs to minimize waste.

Wildcard Masks

A wildcard mask is the mathematical inverse of a subnet mask, calculated by subtracting each octet from 255. For subnet mask 255.255.255.0, the wildcard mask is 0.0.0.255. Cisco routers and switches use wildcard masks in access control lists (ACLs) and OSPF area configurations. Where a subnet mask uses 1s to indicate network bits, a wildcard mask uses 0s to indicate bits that must match and 1s for bits that can vary.

IPv4 Address Classes

Class A (1.0.0.0 - 126.255.255.255): Default mask /8 (255.0.0.0). Supports 16.7 million hosts per network. Reserved for very large organizations and internet backbone infrastructure.

Class B (128.0.0.0 - 191.255.255.255): Default mask /16 (255.255.0.0). Supports 65,534 hosts per network. Used by medium to large organizations, universities, and ISPs.

Class C (192.0.0.0 - 223.255.255.255): Default mask /24 (255.255.255.0). Supports 254 hosts per network. Most common for small business and home networks.

Class D (224.0.0.0 - 239.255.255.255): Reserved for multicast group addresses. Not assignable to individual hosts. Used for streaming media and network discovery protocols.

Class E (240.0.0.0 - 255.255.255.255): Reserved for experimental and future use. Not routable on the public internet.

Private IP Address Ranges (RFC 1918)

Three address blocks are reserved for private networks and not routed on the public internet:

10.0.0.0/8: 10.0.0.0 - 10.255.255.255 (16,777,216 addresses). Commonly used in large enterprise networks with multiple subnets and VLANs.

172.16.0.0/12: 172.16.0.0 - 172.31.255.255 (1,048,576 addresses). Used in medium enterprise environments and cloud infrastructure.

192.168.0.0/16: 192.168.0.0 - 192.168.255.255 (65,536 addresses). The standard range for home routers and small office networks. Most consumer routers default to 192.168.0.x or 192.168.1.x subnets.

How to Use This Subnet Calculator

This subnet calculator helps network administrators, IT students, and anyone working with IP networks quickly determine subnet boundaries, usable host ranges, and network parameters without manual binary calculations.

Step-by-Step Instructions

Step 1 - Enter an IP Address: Type any valid IPv4 address into the IP Address field. This can be any address within the subnet you want to calculate. For example, entering 192.168.1.100 with a /24 prefix will calculate the same subnet as entering 192.168.1.0. The calculator automatically determines the correct network address.

Step 2 - Select a CIDR Prefix: Choose the subnet prefix length from the dropdown menu. Each option shows the CIDR notation, equivalent dotted-decimal subnet mask, and total number of addresses in that subnet. Common choices include /24 (256 addresses) for small networks, /16 (65,536 addresses) for medium networks, and /8 (16.7 million addresses) for large networks.

Step 3 - Calculate: Click the Calculate Subnet button to generate results. The calculator displays the network address, broadcast address, subnet mask, wildcard mask, usable host range, IP class, and whether the address is public or private. All calculations run locally in your browser with no data sent to any server.

Common Use Cases

Network Planning: Determine how many hosts a subnet supports before assigning addresses. Verify that a chosen prefix length provides enough addresses for all devices on a network segment including routers, switches, servers, workstations, printers, and IP phones.

Troubleshooting: Verify that two devices share the same subnet by checking if their IP addresses fall within the same network and broadcast address range. Mismatched subnets prevent direct communication between hosts.

Firewall and ACL Configuration: Calculate wildcard masks needed for Cisco ACLs and OSPF network statements. Determine the exact network address and wildcard pair for permit and deny rules.

Study and Certification: Practice subnetting for CompTIA Network+, CCNA, CCNP, and other networking certifications. Verify manual calculations against the tool's results to build confidence in binary subnet math.

Common Subnet Masks Reference

CIDR Subnet Mask Total Addresses Usable Hosts Typical Use
/32 255.255.255.255 1 1 Host route
/31 255.255.255.254 2 2 Point-to-point link (RFC 3021)
/30 255.255.255.252 4 2 Point-to-point link (traditional)
/29 255.255.255.248 8 6 Small server segment
/28 255.255.255.240 16 14 Small office / DMZ
/27 255.255.255.224 32 30 Small department
/26 255.255.255.192 64 62 Medium office VLAN
/25 255.255.255.128 128 126 Large department
/24 255.255.255.0 256 254 Standard LAN / home network
/22 255.255.252.0 1,024 1,022 Building or campus floor
/20 255.255.240.0 4,096 4,094 Campus network
/16 255.255.0.0 65,536 65,534 Enterprise / data center
/8 255.0.0.0 16,777,216 16,777,214 Large ISP / Class A network

Frequently Asked Questions About Subnetting

What is a subnet mask and why is it important?

A subnet mask is a 32-bit value that divides an IP address into network and host portions. It determines which part of an address identifies the network and which part identifies individual devices. Without correct subnet masks, devices cannot determine whether a destination is on the local network or requires routing through a gateway. Every device on a network segment must share the same subnet mask for proper communication.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation represents a subnet using a slash followed by the number of network bits. For example, /24 means 24 bits are reserved for the network portion, leaving 8 bits for hosts. CIDR replaced the rigid classful addressing system (Class A, B, C) in 1993, allowing more efficient IP address allocation. Writing 192.168.1.0/24 is equivalent to specifying IP 192.168.1.0 with subnet mask 255.255.255.0.

How do I calculate the number of usable hosts in a subnet?

The formula is 2^(32 - prefix length) - 2. The exponent gives the total number of addresses, and subtracting 2 removes the network address (all host bits 0) and broadcast address (all host bits 1). For a /24 subnet: 2^(32-24) - 2 = 256 - 2 = 254 usable hosts. For a /27: 2^(32-27) - 2 = 32 - 2 = 30 usable hosts. The exceptions are /31 (2 usable per RFC 3021) and /32 (1 host route).

What is the difference between a network address and a broadcast address?

The network address is the first address in a subnet where all host bits are 0. It identifies the network itself and cannot be assigned to a device. The broadcast address is the last address where all host bits are 1. Packets sent to the broadcast address are delivered to every device on that subnet. Both addresses are reserved and reduce the usable host count by 2.

What is a wildcard mask and where is it used?

A wildcard mask is the inverse of a subnet mask, calculated by subtracting each octet of the subnet mask from 255. For subnet mask 255.255.255.0, the wildcard is 0.0.0.255. Cisco IOS uses wildcard masks in access control lists (ACLs) and OSPF network statements. A 0 bit means the corresponding bit must match exactly, while a 1 bit means that bit can be anything. Some platforms like Juniper and Linux use standard subnet masks instead of wildcards.

What are private IP address ranges?

RFC 1918 defines three private address ranges not routed on the public internet: 10.0.0.0/8 (10.0.0.0 - 10.255.255.255), 172.16.0.0/12 (172.16.0.0 - 172.31.255.255), and 192.168.0.0/16 (192.168.0.0 - 192.168.255.255). Organizations use these ranges internally and translate them to public addresses using NAT (Network Address Translation) for internet access. Home routers typically use 192.168.0.0/24 or 192.168.1.0/24 by default.

What is VLSM and how does it relate to subnetting?

Variable Length Subnet Masking (VLSM) allows different subnets within the same network to use different prefix lengths. Instead of applying a uniform /24 mask across all segments, VLSM lets administrators assign a /30 (2 hosts) to point-to-point links, a /28 (14 hosts) to a server VLAN, and a /24 (254 hosts) to a user VLAN. This minimizes wasted IP addresses and is a core skill tested in networking certifications.

How do I determine the subnet of a given IP address?

Perform a bitwise AND operation between the IP address and subnet mask. Convert both to binary, compare bit by bit, and output 1 only where both bits are 1. For example, IP 192.168.1.130 with mask 255.255.255.192 (/26): the last octet 130 AND 192 = 128, giving network address 192.168.1.128. The broadcast address is 192.168.1.191, and usable hosts range from 192.168.1.129 to 192.168.1.190.

Can I subnet a subnet (create sub-subnets)?

Yes. Subnetting a subnet simply means applying a longer prefix length to an existing subnet. A /24 network (256 addresses) can be divided into two /25 subnets (128 addresses each), four /26 subnets (64 each), eight /27 subnets (32 each), and so on. Each additional bit in the prefix doubles the number of subnets while halving the addresses per subnet. This hierarchical approach is standard practice in enterprise network design.

What subnet size should I choose for my network?

Choose a subnet that accommodates your current device count plus 20-50% growth headroom. A small office with 20 devices needs at least a /27 (30 usable hosts) but a /26 (62 hosts) provides better room for growth. Point-to-point links between routers only need a /30 (2 hosts) or /31 (2 hosts per RFC 3021). Server segments with 5-10 servers suit a /28 (14 hosts). Avoid oversized subnets as they increase broadcast traffic and waste address space.

Subnetting in Practice

Enterprise Network Design

Enterprise networks typically use a hierarchical subnetting scheme aligned with the organizational structure. A company might allocate 10.0.0.0/8 as the overall network space, then assign /16 blocks to each major site (10.1.0.0/16 for headquarters, 10.2.0.0/16 for the branch office). Within each site, departments receive /24 or /23 subnets. Server VLANs, management networks, and voice VLANs each get appropriately sized subnets based on device count and traffic patterns.

Cloud and Container Networking

Cloud providers like AWS, Azure, and Google Cloud require careful subnet planning for VPCs (Virtual Private Clouds). AWS VPCs support CIDR blocks from /16 to /28. Subnets within a VPC span availability zones, and each subnet reserves 5 addresses (first 4 and last 1) for AWS infrastructure. Container orchestration platforms like Kubernetes allocate pod networks using large CIDR blocks (/16 or larger) to support thousands of containers, each requiring a unique IP address.

Home Network Subnetting

Most home networks use a single /24 subnet (192.168.1.0/24 or 192.168.0.0/24) assigned by the router via DHCP. Advanced users create separate subnets for IoT devices, guest networks, and primary devices to improve security. A home setup might use 192.168.1.0/24 for trusted devices, 192.168.2.0/24 for IoT, and 192.168.3.0/24 for guest access, with firewall rules controlling traffic between segments.

Supernetting and Route Aggregation

Supernetting (route summarization) combines multiple smaller subnets into a single larger route. Four contiguous /24 networks (192.168.0.0 through 192.168.3.0) can be summarized as one /22 route (192.168.0.0/22). This reduces routing table size on backbone routers, improving lookup speed and lowering memory usage. ISPs and large enterprises rely on supernetting to manage hundreds of thousands of routes efficiently.

Subnetting Tips

Document Everything: Maintain an IP address management (IPAM) spreadsheet or tool tracking every subnet, its purpose, VLAN assignment, and gateway address.

Plan for Growth: Allocate subnet sizes 20-50% larger than current needs. Renumbering a network later disrupts services and wastes time.

Use Consistent Schemes: Assign the same relative address for gateways across subnets (e.g., always .1 or .254) for predictable configurations.

Separate Traffic Types: Place servers, workstations, VoIP phones, and management interfaces on separate subnets with inter-VLAN routing and access control.

Reserve Addresses: Set aside a range at the top or bottom of each subnet for static assignments (servers, printers, network equipment) outside the DHCP pool.

Need to check your network's public IP details? Use our IP Address Lookup tool for geolocation and ISP information. Planning your internet connection? Our Internet Speed Requirements Calculator helps determine the bandwidth your household or office needs.