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\nCIDR: /24 (255.255.255.0)\n\nNetwork calculation:\nIP in binary: 11000000.10101000.00001010.00110010\nMask: 11111111.11111111.11111111.00000000\nAND operation:\nNetwork: 11000000.10101000.00001010.00000000\n= 192.168.10.0\n\nBroadcast (all host bits = 1):\n192.168.10.255\n\nUsable range: 192.168.10.1 - 192.168.10.254\nTotal 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\nDivide by 4: Need 2 extra bits (2^2 = 4)\nNew CIDR: /24 + 2 = /26\n\nSubnets created:\n1. 10.0.0.0/26 (10.0.0.1 - 10.0.0.62)\n2. 10.0.0.64/26 (10.0.0.65 - 10.0.0.126)\n3. 10.0.0.128/26 (10.0.0.129 - 10.0.0.190)\n4. 10.0.0.192/26 (10.0.0.193 - 10.0.0.254)\n\nEach 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\nFormula: 2^n - 2 โฅ 50 (need 2 for network/broadcast)\n\nTest values:\n/27: 2^5 - 2 = 30 hosts โ (too small)\n/26: 2^6 - 2 = 62 hosts โ (fits!)\n/25: 2^7 - 2 = 126 hosts โ (works but wastes addresses)\n\nOptimal choice: /26\n- Provides 62 usable hosts\n- Only 12 addresses wasted (62-50)\n- Subnet mask: 255.255.255.192
Result:/26 is optimal (62 usable hosts)
Frequently Asked Questions
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).
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.