Subnet Mask Calculator
A subnet mask calculator is an essential networking tool that helps network administrators and IT professionals determine crucial network information from an IP address and subnet mask. This tool calculates network addresses, broadcast addresses, available host ranges, and other important subnetting details.
What is a Subnet Mask?
A subnet mask is a 32-bit number that divides an IP address into two parts: the network portion and the host portion. It determines which part of an IP address identifies the network and which part identifies the specific host on that network.
Subnet masks are typically expressed in two formats:
- Dotted Decimal Notation: 255.255.255.0
- CIDR Notation: /24
How Subnet Masks Work
Subnet masks use consecutive 1s followed by consecutive 0s. The 1s represent the network portion, and the 0s represent the host portion. For example:
- 255.255.255.0 in binary: 11111111.11111111.11111111.00000000
- This means the first 24 bits are for the network, and the last 8 bits are for hosts
Common Subnet Masks
Here are the most commonly used subnet masks:
| CIDR |
Subnet Mask |
Binary Mask |
Hosts |
Class |
| /8 |
255.0.0.0 |
11111111.00000000.00000000.00000000 |
16,777,214 |
A |
| /16 |
255.255.0.0 |
11111111.11111111.00000000.00000000 |
65,534 |
B |
| /24 |
255.255.255.0 |
11111111.11111111.11111111.00000000 |
254 |
C |
| /30 |
255.255.255.252 |
11111111.11111111.11111111.11111100 |
2 |
Any |
| /32 |
255.255.255.255 |
11111111.11111111.11111111.11111111 |
1 |
Any |
IP Address Classes
IP addresses are divided into five classes based on the first octet:
- Class A: 1.0.0.0 to 126.255.255.255 (default mask: /8)
- Class B: 128.0.0.0 to 191.255.255.255 (default mask: /16)
- Class C: 192.0.0.0 to 223.255.255.255 (default mask: /24)
- Class D: 224.0.0.0 to 239.255.255.255 (used for multicast)
- Class E: 240.0.0.0 to 255.255.255.255 (reserved for future use)
Subnet Calculation Formulas
When you have an IP address and subnet mask, you can calculate:
- Network Address: IP Address AND Subnet Mask
- Broadcast Address: Network Address OR (NOT Subnet Mask)
- First Host: Network Address + 1
- Last Host: Broadcast Address - 1
- Total Hosts: 2^(32 - CIDR)
- Usable Hosts: Total Hosts - 2 (except for /31 and /32)
Practical Uses
Subnet calculators are used for:
- Network Planning: Designing efficient network layouts
- IP Address Management: Allocating IP addresses effectively
- Network Troubleshooting: Identifying network connectivity issues
- Security: Creating isolated network segments
- Documentation: Creating network diagrams and documentation
How to Use This Calculator
- Enter an IP address in the format x.x.x.x
- Choose to input either:
- A subnet mask (e.g., 255.255.255.0)
- A CIDR notation (e.g., /24)
- Click "Calculate" to see all subnet details
- The calculator will display:
- Network address
- Broadcast address
- First and last usable host addresses
- Total and usable host counts
- Binary representation of the subnet mask
- IP address class and subnet type
Tips for Network Administrators
- Use /30 networks for point-to-point links (2 usable hosts)
- Use /24 networks for typical LAN segments (254 usable hosts)
- Consider future growth when selecting subnet sizes
- Document your subnet scheme for consistency
- Use private IP ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) for internal networks
This subnet mask calculator simplifies the complex process of network subnetting, making it easier for both beginners and experienced network professionals to manage IP networks efficiently.