IP Subnet Calculator
Calculate IPv4 subnet details from IP address and CIDR notation or subnet mask. Get network address, broadcast, host range, and usable hosts instantly.
/
Enter your values above to see the results.
Tips & Notes
- ✓CIDR notation /n means the first n bits are the network part. /24 = 255.255.255.0 (256 addresses, 254 hosts). /16 = 255.255.0.0 (65,536 addresses). /8 = 255.0.0.0 (16.7 million addresses). Each step down /n doubles the network size.
- ✓The -2 in usable hosts (2^host_bits − 2) accounts for the network address (all host bits = 0) and broadcast address (all host bits = 1). For a /30 subnet: 2^2 − 2 = 2 usable hosts — minimum for a point-to-point link.
- ✓Private IP address ranges (RFC 1918): 10.0.0.0/8 (16.7M addresses), 172.16.0.0/12 (1M addresses), 192.168.0.0/16 (65,536 addresses). These are not routed on the public internet and are reused by NAT in private networks.
- ✓Subnetting strategy: for 50 hosts needed, you need 2^n ≥ 52 (add 2 for network/broadcast), so n=6 host bits → /26 subnet (64 addresses, 62 hosts). For 200 hosts: 2^8 = 256 ≥ 202 → /24 subnet (256 addresses, 254 hosts).
- ✓IPv6 uses 128-bit addresses in hexadecimal — subnetting concepts are the same but the address space is 340 undecillion addresses. Standard IPv6 allocations: /48 per organization, /64 per subnet (18.4 quintillion addresses per subnet).
Common Mistakes
- ✗Using the network address or broadcast address as a host address — the first address (network address) and last address (broadcast) in each subnet cannot be assigned to hosts. A /24 subnet gives 256 addresses but only 254 usable host addresses.
- ✗Confusing subnet mask and prefix length — 255.255.255.0 and /24 mean the same thing. Converting: count the consecutive 1 bits in the subnet mask. 255.255.255.0 = 11111111.11111111.11111111.00000000 = 24 ones = /24.
- ✗Planning subnets too small — always over-provision by at least 25%. A department of 50 users needs a /26 (62 hosts), not a /26 with exactly 62 — add IP phones, printers, IoT devices, future growth. Use /25 (126 hosts) instead.
- ✗Assigning IPs from different subnets on the same VLAN — devices in the same broadcast domain must be in the same subnet. Placing 192.168.1.5/24 and 192.168.2.5/24 on the same switch port causes routing failures.
- ✗Forgetting to account for gateway address — the router interface in each subnet uses one host address (typically the first usable host, e.g., .1). A /28 subnet (14 hosts) loses one to the gateway, leaving 13 for endpoints.
IP Subnet Calculator Overview
IP subnetting divides a large address block into smaller, manageable segments for routing efficiency, security isolation, and network organization. Understanding CIDR notation and bitwise subnet math is fundamental to network engineering.
Subnet calculation formulas:
Network = IP AND Mask | Broadcast = Network OR (NOT Mask) | Usable Hosts = 2^(32−prefix) − 2
EX: 172.16.45.67/20 → Mask = 255.255.240.0 → Network = 172.16.32.0 → Broadcast = 172.16.47.255 → Hosts = 2^12 − 2 = 4,094 usable. Range: 172.16.32.1 to 172.16.47.254CIDR to subnet mask conversion:
Write n ones + (32-n) zeros, convert each 8 bits to decimal | /24 = 255.255.255.0 | /16 = 255.255.0.0
EX: /21 → 21 ones + 11 zeros = 11111111.11111111.11111000.00000000 = 255.255.248.0. Hosts = 2^11 − 2 = 2,046. Block size = 256 − 248 = 8 (network addresses increment by 8 in third octet)Subnet size quick reference:
| CIDR | Subnet Mask | Total Addresses | Usable Hosts | Common Use |
|---|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point WAN links |
| /29 | 255.255.255.248 | 8 | 6 | Very small segments |
| /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 department |
| /25 | 255.255.255.128 | 128 | 126 | Large department |
| /24 | 255.255.255.0 | 256 | 254 | Standard LAN segment |
| /23 | 255.255.254.0 | 512 | 510 | Large LAN |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large enterprise |
| Range | CIDR | Addresses | Typical Use |
|---|---|---|---|
| 10.0.0.0–10.255.255.255 | 10.0.0.0/8 | 16,777,216 | Large enterprise, cloud VPCs |
| 172.16.0.0–172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Medium enterprise |
| 192.168.0.0–192.168.255.255 | 192.168.0.0/16 | 65,536 | Home networks, small office |
| 169.254.0.0–169.254.255.255 | 169.254.0.0/16 | 65,536 | Link-local (APIPA — no DHCP) |
| 127.0.0.0–127.255.255.255 | 127.0.0.0/8 | 16,777,216 | Loopback (localhost = 127.0.0.1) |
Frequently Asked Questions
Network address: perform bitwise AND between the IP address and subnet mask. Broadcast address: perform bitwise OR between the network address and the bitwise complement (NOT) of the subnet mask. Example: IP 192.168.10.100, mask 255.255.255.0 (/24). Network = 192.168.10.100 AND 255.255.255.0 = 192.168.10.0. Broadcast = 192.168.10.0 OR 0.0.0.255 = 192.168.10.255. Usable hosts: 192.168.10.1 to 192.168.10.254 (254 hosts).
CIDR /n means n bits are set to 1 (network portion). To convert /n to mask: write n ones followed by (32-n) zeros, split into four 8-bit groups. /24: 24 ones then 8 zeros = 11111111.11111111.11111111.00000000 = 255.255.255.0. /20: 20 ones then 12 zeros = 11111111.11111111.11110000.00000000 = 255.255.240.0. /27: 27 ones then 5 zeros = 11111111.11111111.11111111.11100000 = 255.255.255.224. To convert mask to CIDR: count the 1 bits in the mask.
Usable hosts = 2^(32-prefix) − 2. Common prefix lengths: /30 = 2 hosts (point-to-point links); /29 = 6 hosts; /28 = 14 hosts; /27 = 30 hosts; /26 = 62 hosts; /25 = 126 hosts; /24 = 254 hosts; /23 = 510 hosts; /22 = 1,022 hosts; /21 = 2,046 hosts; /20 = 4,094 hosts; /16 = 65,534 hosts; /8 = 16,777,214 hosts. Choose the smallest subnet that fits your requirements plus 25% growth margin.
RFC 1918 defines three private IPv4 address ranges that are not routed on the public internet: Class A: 10.0.0.0 to 10.255.255.255 (10.0.0.0/8, 16.7M addresses — used by large enterprises); Class B: 172.16.0.0 to 172.31.255.255 (172.16.0.0/12, 1M addresses); Class C: 192.168.0.0 to 192.168.255.255 (192.168.0.0/16, 65,536 addresses — common in home networks). Network Address Translation (NAT) maps these private addresses to one or more public IPs for internet access, allowing billions of devices to share the limited public IPv4 address space.
Variable-length subnet masking (VLSM) assigns different subnet sizes to different departments based on actual need. Process: 1) List departments by host count in descending order. 2) Assign the smallest subnet that fits each, starting from the largest requirement. 3) Leave gaps for future growth. Example: Sales (100 hosts) → /25 (126 hosts). IT (50 hosts) → /26 (62 hosts). Management (20 hosts) → /27 (30 hosts). Servers (10 hosts) → /28 (14 hosts). Point-to-point links → /30 (2 hosts each). Starting from 10.10.0.0/24: Sales gets 10.10.0.0/25, IT gets 10.10.0.128/26, Management gets 10.10.0.192/27, etc.
IPv4 uses 32-bit addresses (4.3 billion total) written in dotted decimal (192.168.1.1). IPv6 uses 128-bit addresses (340 undecillion) written in hexadecimal with colons (2001:db8::1). IPv4 subnetting is driven by address scarcity — every host bit matters. IPv6 subnetting is driven by hierarchical routing — the standard allocation is /48 per organization (280 trillion subnets per organization, each with /64 prefix and 18.4 quintillion addresses per subnet). IPv6 eliminates the need for NAT: every device can have a globally unique address. IPv6 subnets are always /64 in practice, giving enough addresses to number every atom on Earth many times over.