Subnet Calculator

Calculate subnet mask, network address, broadcast address, and usable host range from an IP address and CIDR prefix.

/24
For VLSM planning
For optimal prefix calc
Network Address
192.168.1.0
/24 โ€” C (Private)
Broadcast Address
192.168.1.255
Last address in the subnet
Subnet Mask
255.255.255.0
Binary: 11111111.11111111.11111111.00000000
Wildcard Mask
0.0.0.255
Inverse of subnet mask โ€” used in ACLs
Usable Host Range
192.168.1.1 โ€” 192.168.1.254
254.00 usable hosts
Total Addresses
256.00
8 host bits โ€” 2^8
Subnetting Result
/26
4 subnets โ†’ 62.00 hosts each
Optimal Prefix for Hosts
/26
Need 50 hosts โ†’ /26 gives 62.00
Address Space Utilization (/24)
254.00 usable
Network addr (1)Usable hosts (254.00)Broadcast (1)

Common Subnet Reference

CIDRSubnet MaskTotal AddrsUsable Hosts
/8255.0.0.016,777,216.0016,777,214.00
/16255.255.0.065,536.0065,534.00
/20255.255.240.04,096.004,094.00
/24255.255.255.0256.00254.00
/25255.255.255.128128.00126.00
/26255.255.255.19264.0062.00
/27255.255.255.22432.0030.00
/28255.255.255.24016.0014.00
/29255.255.255.2488.006.00
/30255.255.255.2524.002.00
/31255.255.255.2542.002.00
/32255.255.255.2551.001.00
Planning notes, formulas, and examples

About the Subnet Calculator

Subnetting divides a larger network into smaller, more manageable segments. Each subnet has a network address, a broadcast address, and a range of usable host addresses. The subnet mask (or CIDR prefix length) determines how many hosts each subnet can accommodate.

This calculator takes a CIDR prefix length and computes the subnet mask, number of total and usable addresses, network address, and broadcast address. It is an essential tool for network engineers planning IP address allocation, VPC design, and firewall rules.

Understanding subnetting is fundamental to cloud networking. Every VPC, security group, and load balancer configuration requires accurate subnet calculations. Mistakes in subnet sizing lead to address exhaustion, routing conflicts, and security vulnerabilities.

When This Page Helps

Accurate subnet calculations prevent IP address conflicts, ensure proper network segmentation, and are required for VPC design, firewall rules, and security group configuration.

How to Use the Inputs

  1. Enter the CIDR prefix length (e.g., 24 for a /24 network).
  2. Review the subnet mask, total addresses, and usable host count.
  3. Use the results to plan IP allocation for your network.
  4. Adjust the prefix to find the right subnet size for your needs.
Formula used
Total Addresses = 2^(32 โˆ’ prefix) Usable Hosts = Total โˆ’ 2 (network and broadcast) Subnet Mask = 32 bits with first `prefix` bits set to 1 Host Bits = 32 โˆ’ prefix

Example Calculation

Result: /24: 256 total, 254 usable hosts, mask 255.255.255.0

A /24 network has 32 โˆ’ 24 = 8 host bits. Total addresses: 2^8 = 256. Usable hosts: 256 โˆ’ 2 = 254. Subnet mask: 11111111.11111111.11111111.00000000 = 255.255.255.0.

Tips & Best Practices

  • Use /24 (254 hosts) for typical office or application subnets.
  • Use /28 (14 hosts) for small DMZ or management subnets.
  • Always leave room for growth โ€” choose one prefix size larger than minimum need.
  • RFC 1918 private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
  • Cloud VPCs typically support /16 to /28 subnets.
  • Document subnet allocations in an IPAM (IP Address Management) system.

Subnet Sizing for Cloud Networks

Cloud VPC design requires careful subnet planning. Under-sized subnets run out of addresses as services scale. Over-sized subnets waste address space and reduce segmentation options. Plan for 3โ€“5 years of growth when choosing subnet sizes.

Common Subnet Sizes

/24 (254 hosts) is the workhorse for most application subnets. /20 (4,094 hosts) suits large Kubernetes clusters or auto-scaling groups. /28 (14 hosts) works for load balancers, NAT gateways, and management subnets. /16 (65,534 hosts) is typical for VPC-level allocation.

Subnet Security and Segmentation

Subnets are a primary network security boundary. Place different security tiers (public, private, data) in separate subnets with security groups and NACLs controlling traffic between them. Never mix public-facing and internal resources in the same subnet.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • CIDR (Classless Inter-Domain Routing) notation uses a slash followed by the number of network bits. /24 means the first 24 bits are the network portion, leaving 8 bits for hosts. Larger prefix = smaller subnet. /32 is a single host.