IP Subnet Calculator - CIDR Network Tool
Calculate IP subnets, CIDR notation, usable host ranges, and network masks. Supports IPv4 subnetting for network planning and troubleshooting.
Formula
Usable Hosts = 2^(32-CIDR) - 2
The formula calculates host addresses by raising 2 to the power of host bits (32 minus CIDR prefix), then subtracting 2 for the reserved network and broadcast addresses.
Worked Examples
Example 1: Basic Subnet Calculation
Problem:Calculate subnet details for 192.168.10.50/24
Solution:IP Address: 192.168.10.50 CIDR: /24 (255.255.255.0) Network calculation: IP in binary: 11000000.10101000.00001010.00110010 Mask: 11111111.11111111.11111111.00000000 AND operation: Network: 11000000.10101000.00001010.00000000 = 192.168.10.0 Broadcast (all host bits = 1): 192.168.10.255 Usable range: 192.168.10.1 - 192.168.10.254 Total hosts: 2^8 - 2 = 254
Result:Network: 192.168.10.0/24 | Hosts: 254
Example 2: Subnet into Smaller Networks
Problem:Divide 10.0.0.0/24 into 4 equal subnets
Solution:Original: 10.0.0.0/24 = 256 addresses Divide by 4: Need 2 extra bits (2^2 = 4) New CIDR: /24 + 2 = /26 Subnets created: 1. 10.0.0.0/26 (10.0.0.1 - 10.0.0.62) 2. 10.0.0.64/26 (10.0.0.65 - 10.0.0.126) 3. 10.0.0.128/26 (10.0.0.129 - 10.0.0.190) 4. 10.0.0.192/26 (10.0.0.193 - 10.0.0.254) Each subnet: 64 total, 62 usable hosts
Result:4 subnets of /26 (62 hosts each)
Example 3: Find Correct Subnet for Host Count
Problem:You need a subnet for 50 hosts. What's the smallest CIDR that works?
Solution:Required hosts: 50 Formula: 2^n - 2 ≥ 50 (need 2 for network/broadcast) Test values: /27: 2^5 - 2 = 30 hosts ❌ (too small) /26: 2^6 - 2 = 62 hosts ✓ (fits!) /25: 2^7 - 2 = 126 hosts ✓ (works but wastes addresses) Optimal choice: /26 - Provides 62 usable hosts - Only 12 addresses wasted (62-50) - Subnet mask: 255.255.255.192
Result:/26 is optimal (62 usable hosts)
Frequently Asked Questions
What is CIDR notation and how does it work?
CIDR (Classless Inter-Domain Routing) notation expresses IP addresses with their subnet mask in the format IP/prefix. The number after the slash indicates how many bits are used for the network portion. /24 means 24 bits for network (256 addresses), /16 means 16 bits (65,536 addresses). Each bit doubles or halves the network size. CIDR replaced classful addressing, allowing more flexible network sizing. For example, 192.168.1.0/24 represents a network of 256 addresses with 254 usable hosts.
How do I calculate the number of usable hosts in a subnet?
Usable hosts = 2^(32-CIDR) - 2. Subtract 2 because the first address is reserved for the network address and the last for broadcast. Examples: /24 = 2^8 - 2 = 254 hosts. /25 = 2^7 - 2 = 126 hosts. /26 = 2^6 - 2 = 62 hosts. Exception: /31 and /32 subnets. /31 (point-to-point links per RFC 3021) has 2 usable addresses. /32 represents a single host. These special cases are used in specific scenarios.
What's the difference between subnet mask and wildcard mask?
Subnet mask marks network bits with 1s and host bits with 0s (e.g., 255.255.255.0). Wildcard mask is the inverse - 0s for network, 1s for hosts (e.g., 0.0.0.255). Subnet masks are used in IP configuration. Wildcard masks are used in access control lists (ACLs) and routing protocols like OSPF. To convert: wildcard = 255.255.255.255 - subnet mask. Wildcard masks define which bits to match (0) and which to ignore (1).
What is a broadcast address and why is it reserved?
The broadcast address is the last address in a subnet, used to send data to ALL hosts in that network simultaneously. For 192.168.1.0/24, broadcast is 192.168.1.255. When a device sends to this address, every device on the subnet receives the packet. It's essential for protocols like ARP (finding MAC addresses) and DHCP (discovering DHCP servers). The broadcast address cannot be assigned to any device, hence 'usable hosts' excludes it.
What are the private IP address ranges?
Private IP ranges (RFC 1918) are reserved for internal networks and not routable on the internet: Class A: 10.0.0.0/8 (10.0.0.0 - 10.255.255.255) - 16 million addresses. Class B: 172.16.0.0/12 (172.16.0.0 - 172.31.255.255) - 1 million addresses. Class C: 192.168.0.0/16 (192.168.0.0 - 192.168.255.255) - 65,000 addresses. These addresses require NAT (Network Address Translation) to access the internet.
How do I subnet a network into smaller segments?
To subnet, increase the CIDR number (borrow bits from host portion). A /24 network (256 addresses) can be split into: 2 /25 networks (128 addresses each), 4 /26 networks (64 each), 8 /27 networks (32 each), etc. Each additional bit doubles the number of subnets while halving hosts per subnet. Example: Split 192.168.1.0/24 into /26 subnets: 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, 192.168.1.192/26 (62 usable hosts each).
What is supernetting (CIDR aggregation)?
Supernetting combines multiple smaller networks into one larger network by decreasing the CIDR number (opposite of subnetting). This reduces routing table size through route summarization. Example: 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24 can be summarized as 192.168.0.0/22 (one route instead of four). Requirements: Networks must be contiguous and the count must be a power of 2. Supernetting is essential for internet routing efficiency.
What's the difference between network ID and IP address?
An IP address identifies a specific device on a network. The network ID (network address) identifies the subnet itself - it's the first address where all host bits are 0. For 192.168.1.100/24: IP is 192.168.1.100 (specific device), Network ID is 192.168.1.0 (the subnet). Network ID cannot be assigned to a device. Routers use network IDs to determine where to forward packets. The subnet mask separates network and host portions of any IP in that range.
How do I determine if two IPs are on the same subnet?
Apply the subnet mask (AND operation) to both IP addresses. If the results match, they're on the same subnet. Example with /24: IP1: 192.168.1.50, IP2: 192.168.1.200. Apply mask 255.255.255.0: Both give 192.168.1.0 - same subnet. IP3: 192.168.2.50 gives 192.168.2.0 - different subnet. For /25: 192.168.1.50 (mask 255.255.255.128) = 192.168.1.0. 192.168.1.200 = 192.168.1.128 - different subnets!
What is VLSM and why is it important?
VLSM (Variable Length Subnet Mask) allows using different subnet sizes within the same network, maximizing IP address efficiency. Without VLSM, you'd use the same size for all subnets, wasting addresses. Example: You need networks for 100, 50, 25, and 2 hosts. With VLSM: 100 hosts → /25 (126 usable), 50 → /26 (62), 25 → /27 (30), 2 → /30 (2). Without VLSM, you'd need /25 for all, wasting addresses. VLSM requires CIDR-aware routing protocols (OSPF, EIGRP, BGP).