IP Subnet Calculator
IP Subnet Calculator
Calculate network info from IP address and subnet mask
CIDR to Subnet Mask Converter
Convert between CIDR notation and subnet mask
Wildcard Mask Calculator
Calculate wildcard mask from subnet mask (inverse)
Subnetting Calculator
Divide network into multiple subnets
Calculation Results
—
These calculations help with network planning and IP address management. Always verify results in your actual network configuration. IPv4 addresses use 32 bits divided into 4 octets (0-255). CIDR notation /24 means first 24 bits are network, last 8 bits are host addresses.
IP Subnetting & Networking Guide
Understanding IP addressing and subnetting is fundamental for network administration and configuration. This guide explains IPv4 fundamentals, subnet masks, CIDR notation, and practical subnetting strategies.
IPv4 Address Structure
An IPv4 address consists of 32 bits divided into 4 octets (each 8 bits = 0-255). Example: 192.168.1.10
| Octet 1 | Octet 2 | Octet 3 | Octet 4 | Total Bits |
|---|---|---|---|---|
| 192 | 168 | 1 | 10 | 32 bits |
| Network | Network | Network | Host | (depends on mask) |
Subnet Mask Basics
A subnet mask determines which portion of an IP address is the network and which is the host. Subnet masks use continuous 1s followed by continuous 0s.
| Subnet Mask | CIDR | Hosts | Class | Common Use |
|---|---|---|---|---|
| 255.0.0.0 | /8 | 16,777,214 | Class A | Large organizations |
| 255.255.0.0 | /16 | 65,534 | Class B | Medium networks |
| 255.255.255.0 | /24 | 254 | Class C | Small networks (most common) |
| 255.255.255.128 | /25 | 126 | Class C Subnet | Small office networks |
| 255.255.255.192 | /26 | 62 | Class C Subnet | Department subnets |
| 255.255.255.224 | /27 | 30 | Class C Subnet | Point-to-point links |
| 255.255.255.252 | /30 | 2 | Class C Subnet | Router links |
CIDR Notation
Notation: IP_ADDRESS/PREFIX_LENGTH. Example: 192.168.1.0/24
The number after the slash (24) indicates how many bits are network bits. Remaining bits (32-24=8) are host bits. /24 = 256 addresses (0-255), with 254 usable hosts (excluding network and broadcast).
Private IP Address Ranges (RFC 1918)
| Class | Range | CIDR | Addresses | Use Case |
|---|---|---|---|---|
| Class A | 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 | 16,777,216 | Large enterprises |
| Class B | 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Medium networks, cloud |
| Class C | 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | 65,536 | Small networks, homes |
| Loopback | 127.0.0.0 - 127.255.255.255 | 127.0.0.0/8 | 16,777,216 | Local machine (127.0.0.1) |
| Link-Local | 169.254.0.0 - 169.254.255.255 | 169.254.0.0/16 | 65,536 | Auto-configuration |
Wildcard Mask (Inverse Mask)
A wildcard mask is the inverse of a subnet mask - where 0s mean "match" and 1s mean "ignore". Used in ACLs and routing rules.
Example:
- Subnet: 255.255.255.0
- Wildcard: 0.0.0.255
- Matches any address in 192.168.1.0/24
Calculating Hosts in a Subnet
| CIDR | Host Bits | Total Addresses | Usable Hosts |
|---|---|---|---|
| /8 | 24 | 16,777,216 | 16,777,214 |
| /16 | 16 | 65,536 | 65,534 |
| /24 | 8 | 256 | 254 |
| /25 | 7 | 128 | 126 |
| /26 | 6 | 64 | 62 |
| /27 | 5 | 32 | 30 |
| /28 | 4 | 16 | 14 |
| /29 | 3 | 8 | 6 |
| /30 | 2 | 4 | 2 |
| /31 | 1 | 2 | 0 (point-to-point) |
| /32 | 0 | 1 | 1 (host route) |
Special IP Addresses
- Network Address: First address in subnet, all host bits = 0 (e.g., 192.168.1.0). Cannot be assigned to devices.
- Broadcast Address: Last address in subnet, all host bits = 1 (e.g., 192.168.1.255). Used to send packets to all hosts in subnet.
- Gateway/Router: Usually first usable address (e.g., 192.168.1.1)
- Usable Hosts: All addresses between network and broadcast (e.g., 192.168.1.1 to 192.168.1.254)
Subnetting Strategies
- Variable Length Subnet Masking (VLSM): Use different mask lengths for different subnets to maximize address efficiency
- Supernetting: Combine multiple networks into single larger network
- Aggregate Routes: Reduce routing table size by summarizing subnets
- Plan for Growth: Choose subnets with room for expansion
- Separate Departments: Use different subnets for different departments/functions
Common Subnet Scenarios
| Scenario | Subnet Mask | CIDR | Hosts |
|---|---|---|---|
| Small Home Network | 255.255.255.0 | /24 | 254 devices |
| Small Office (20 PCs) | 255.255.255.224 | /27 | 30 hosts |
| Department (100 users) | 255.255.255.0 | /24 | 254 hosts |
| Data Center | 255.255.0.0 | /16 | 65,534 hosts |
| WAN Link (Router-to-Router) | 255.255.255.252 | /30 | 2 hosts |
Explore More Tools
Networking Tools
Conversion Tools
Other Tools
Frequently Asked Questions
1. What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation represents an IP address and subnet mask in shorthand. Format: IP_ADDRESS/PREFIX. Example: 192.168.1.0/24 means the first 24 bits identify the network, last 8 bits identify the host.
2. How do I calculate the number of hosts in a subnet?
Formula: 2^(32-CIDR) - 2. For /24: 2^(32-24) - 2 = 256 - 2 = 254 usable hosts. The -2 accounts for network and broadcast addresses which cannot be assigned to devices.
3. What's the difference between subnet mask and wildcard mask?
Subnet mask has 1s for network bits, 0s for host bits. Wildcard is the inverse: 0s for network bits, 1s for host bits. Used in different contexts (subnet configuration vs access control lists).
4. Can I use 192.168.1.0 as a host address?
No. 192.168.1.0 is the network address (all host bits = 0) and is reserved. 192.168.1.255 is the broadcast address (all host bits = 1). Usable host range is 192.168.1.1 to 192.168.1.254.
5. What is supernetting?
Supernetting combines multiple adjacent subnets into a larger network using a shorter prefix. Example: 192.168.0.0/24 and 192.168.1.0/24 can be combined to 192.168.0.0/23. Reduces routing table size.
6. How many subnets can I create from 10.0.0.0/8?
Theoretically millions. Using /16 gives 256 subnets. Using /24 gives 65,536 subnets. The choice depends on your network size needs. More subnets = fewer hosts per subnet.
7. What is VLSM?
Variable Length Subnet Masking allows using different subnet mask lengths within the same network. Efficient for networks with varying requirements - large subnets for departments, smaller /30 for router links.
8. Why use /30 for WAN links?
Because WAN links only need 2 hosts (router on each end). /30 provides exactly 4 addresses (2 usable), minimizing address waste. Formula: 2^(32-30) = 4 total addresses.
9. What's the broadcast address for 172.16.5.0/25?
With /25, last 7 bits are host bits. Broadcast = network address + (2^7 - 1) = 172.16.5.0 + 127 = 172.16.5.127. All host bits set to 1.
10. Can I use /31 subnets?
Yes, for point-to-point links (RFC 3021). /31 provides 2 addresses with no broadcast address. Used for router-to-router links to conserve addresses.
11. How do I subnet 10.0.0.0/8 for 5 departments?
Use /11: 10.0.0.0/11, 10.32.0.0/11, 10.64.0.0/11, 10.96.0.0/11, 10.128.0.0/11. Each /11 provides 2 million hosts. Or use /16 for each department for 65,534 hosts each.
12. What is a default gateway?
The IP address of the router on your network. Usually the first usable address (.1) in your subnet. Packets destined for other networks go to the default gateway. Example: 192.168.1.1 in 192.168.1.0/24.