- Overview
- Calculators
- Subnet Calculator
Subnet Calculator
This subnet calculator computes network details for any IPv4 address and CIDR prefix length. Enter an IP address and prefix to instantly see the network address, broadcast address, usable host range, subnet mask, wildcard mask, total and usable hosts, IP class, and binary representations.
Subnet Calculator
Enter an IPv4 address and CIDR prefix length to calculate subnet details including network range, usable hosts, and binary representations.
Results
CIDR Notation
192.168.1.0/24
Network Address
192.168.1.0
Broadcast Address
192.168.1.255
Subnet Mask
255.255.255.0
Wildcard Mask
0.0.0.255
First Usable Host
192.168.1.1
Last Usable Host
192.168.1.254
Total Hosts
256
Usable Hosts
254
IP Class
Class C
Private IP
Yes
Binary Representations
IP Address Binary
11000000.10101000.00000001.00000000Subnet Mask Binary
11111111.11111111.11111111.00000000Common Subnet Quick Reference
| CIDR | Subnet Mask | Total Hosts | Usable |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /32 | 255.255.255.255 | 1 | 1 |
Frequently Asked Questions
What is a subnet?
A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting divides a larger network into smaller, more efficient segments. Each subnet has its own network address, broadcast address, and range of usable host addresses. Subnetting improves network performance by reducing broadcast traffic, enhances security by isolating network segments, and allows more efficient use of IP address space.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation is a compact way to specify an IP address and its associated subnet mask. It is written as an IP address followed by a forward slash and a number (the prefix length), such as 192.168.1.0/24. The prefix length indicates how many of the 32 bits in the IPv4 address are used for the network portion. A /24 means the first 24 bits are the network part, leaving 8 bits for host addresses (256 total, 254 usable).
What is the difference between a subnet mask and a wildcard mask?
A subnet mask and a wildcard mask are bitwise inverses of each other. The subnet mask has 1s in the network bits and 0s in the host bits (e.g., 255.255.255.0 for /24). The wildcard mask flips this: 0s in the network bits and 1s in the host bits (e.g., 0.0.0.255 for /24). Subnet masks are used in interface configuration and routing, while wildcard masks are commonly used in access control lists (ACLs) on Cisco routers and in OSPF area configurations.
What are the network address and broadcast address?
The network address is the first address in a subnet (all host bits set to 0) and identifies the subnet itself. It cannot be assigned to a host. The broadcast address is the last address in a subnet (all host bits set to 1) and is used to send packets to all hosts on the subnet simultaneously. For example, in the subnet 192.168.1.0/24, the network address is 192.168.1.0 and the broadcast address is 192.168.1.255.
How many usable hosts does a subnet have?
The number of usable hosts in a subnet is 2^(32 - prefix length) - 2. The subtraction of 2 accounts for the network address and broadcast address, which cannot be assigned to hosts. For example, a /24 subnet has 2^8 - 2 = 254 usable hosts, a /25 has 126, and a /26 has 62. Special cases: a /31 (RFC 3021) has 2 usable addresses for point-to-point links, and a /32 represents a single host.
What are private IP addresses?
Private IP addresses are reserved by RFC 1918 for use within private networks and are not routable on the public internet. The three private ranges are: 10.0.0.0/8 (10.0.0.0 to 10.255.255.255, 16.7 million addresses), 172.16.0.0/12 (172.16.0.0 to 172.31.255.255, about 1 million addresses), and 192.168.0.0/16 (192.168.0.0 to 192.168.255.255, 65,536 addresses). Devices with private addresses use NAT (Network Address Translation) to access the internet.
What are IP address classes?
IPv4 addresses were historically divided into five classes based on the first octet. Class A (1-127) uses a /8 default mask and supports about 16 million hosts per network. Class B (128-191) uses /16 with about 65,000 hosts. Class C (192-223) uses /24 with 254 hosts. Class D (224-239) is reserved for multicast. Class E (240-255) is reserved for experimental use. While CIDR has replaced classful addressing in practice, the concept is still tested on networking certifications.
When should I use a /30 or /31 subnet?
A /30 subnet provides 4 addresses (2 usable hosts) and is traditionally used for point-to-point links between two routers, where each end needs exactly one IP address. A /31 subnet (RFC 3021) provides 2 addresses with no network or broadcast overhead, making it even more efficient for point-to-point links. Most modern router operating systems support /31 subnets. Use /30 if you need backward compatibility; use /31 for maximum address efficiency on router-to-router links.
Understanding IP Subnetting and CIDR Notation
About This Subnet Calculator
This subnet calculator is a free online tool for network engineers, system administrators, IT students, and anyone working with IPv4 networks. Given an IP address and a CIDR prefix length, it instantly computes the network address, broadcast address, usable host range, subnet mask, wildcard mask, total and usable host counts, IP class, and whether the address falls within a private range.
The calculator also displays the binary representations of both the IP address and the subnet mask, making it an excellent learning tool for understanding how subnetting works at the bit level. Every result field can be individually copied to the clipboard for quick use in configuration files, documentation, or network diagrams.
All calculations run entirely in your browser. No data is sent to any server, and no signup is required.
How to Use
Using the subnet calculator is straightforward. Follow these steps to calculate subnet details for any IPv4 address and prefix combination.
- Enter an IPv4 address: Type a valid IPv4 address in dotted-decimal notation in the IP address field, such as 192.168.1.0, 10.0.0.1, or 172.16.50.100. The calculator validates your input in real time and shows an error if the address is malformed.
- Set the CIDR prefix length: Enter a number between 0 and 32 in the prefix length field, or use the quick-select buttons to choose common values like /8, /16, /24, /25, /26, /27, /28, /29, /30, or /32. The prefix determines how many bits are used for the network portion of the address.
- Review the results: As soon as both inputs are valid, the calculator displays the complete subnet information including network address, broadcast address, host range, masks, host counts, IP class, and private/public status.
- Copy results: Click the copy icon next to any individual field to copy that value to your clipboard, or use the "Copy All" button to copy all results at once. This is useful when configuring routers, firewalls, or documenting network designs.
- Examine binary representations: Scroll down within the results to see the binary form of the IP address and subnet mask. This is especially helpful for learning how the logical AND operation between the IP and mask produces the network address.
What is Subnetting?
Subnetting is the practice of dividing a larger IP network into smaller, more manageable sub-networks (subnets). Each subnet operates as an independent network segment with its own network address, broadcast address, and usable host range. Subnetting is one of the most fundamental concepts in IP networking and is essential for efficient address allocation, network security, and traffic management.
When an organization receives a block of IP addresses (such as a /16 with 65,536 addresses), it would be impractical and insecure to place all devices on a single flat network. Subnetting allows the organization to divide this block into smaller segments: separate subnets for different departments, floors, buildings, or functions (servers, printers, guest Wi-Fi, IoT devices, etc.).
Subnetting works by borrowing bits from the host portion of an IP address and reassigning them to the network portion. For example, a Class C network (192.168.1.0/24) has 8 host bits and supports 254 usable hosts. By borrowing 2 host bits to create a /26 prefix, you create 4 subnets of 62 usable hosts each. The trade-off is always between the number of subnets and the number of hosts per subnet.
The key benefits of subnetting include:
- Efficient address utilization: Allocating only the addresses needed for each network segment, reducing waste.
- Improved security: Isolating sensitive systems (like servers or management interfaces) on separate subnets with firewall rules controlling traffic between them.
- Reduced broadcast traffic: Smaller subnets mean smaller broadcast domains, reducing unnecessary traffic and improving performance.
- Simplified management: Organizing devices logically by function, location, or security level makes administration and troubleshooting easier.
- Routing efficiency: Subnets enable route summarization (supernetting), reducing the size of routing tables and improving router performance.
Understanding CIDR Notation
CIDR (Classless Inter-Domain Routing) notation is the modern standard for specifying IP addresses and their associated subnet masks. It was introduced in 1993 (RFC 1518, RFC 1519) to replace the rigid classful addressing system and slow the exhaustion of IPv4 addresses.
CIDR notation appends a forward slash and a number (the prefix length) to an IP address. For example, 192.168.1.0/24 means the first 24 bits are the network portion and the remaining 8 bits are the host portion. The prefix length can be any value from 0 to 32, allowing networks of any size rather than being limited to the classful boundaries of /8, /16, and /24.
The prefix length directly determines the subnet mask. A /24 prefix means the first 24 bits of the 32-bit subnet mask are set to 1 and the remaining 8 bits are set to 0, producing the mask 255.255.255.0 (binary: 11111111.11111111.11111111.00000000). A /26 prefix produces 255.255.255.192 (binary: 11111111.11111111.11111111.11000000).
CIDR Prefix to Subnet Mask:
Subnet Mask = first N bits set to 1, remaining (32-N) bits set to 0
For example, /24 = 11111111.11111111.11111111.00000000 = 255.255.255.0
CIDR notation is used everywhere in modern networking: router configurations, firewall rules, cloud provider VPC settings, DNS zone files, access control lists, and network documentation. Understanding CIDR is essential for any networking professional.
Common Subnet Masks
Below is a comprehensive table of all CIDR prefix lengths from /8 to /32, showing the corresponding subnet mask in dotted-decimal notation, the total number of addresses in the subnet, and the number of usable host addresses (total minus 2 for network and broadcast addresses, with special cases for /31 and /32).
| CIDR | Subnet Mask | Total Addresses | Usable Hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 |
| /32 | 255.255.255.255 | 1 | 1 |
IP Address Classes
Before CIDR, IPv4 addresses were divided into five classes (A through E) based on the value of the first octet. While classful addressing is largely obsolete in modern networking, understanding IP classes remains important for networking exams, legacy systems, and general IP addressing knowledge.
| Class | First Octet Range | Default Mask | Purpose |
|---|---|---|---|
| A | 0 - 127 | /8 (255.0.0.0) | Large networks (16M hosts each) |
| B | 128 - 191 | /16 (255.255.0.0) | Medium networks (65K hosts each) |
| C | 192 - 223 | /24 (255.255.255.0) | Small networks (254 hosts each) |
| D | 224 - 239 | N/A | Multicast |
| E | 240 - 255 | N/A | Reserved / Experimental |
Note: 127.0.0.0/8 is reserved for loopback (localhost) and is technically within the Class A range but is not assigned to any network. Class D addresses are used for multicast groups, and Class E addresses are reserved for experimental use and are not routable on the public internet.
Private IP Address Ranges
RFC 1918 defines three blocks of IPv4 address space reserved for private use. These addresses are not routable on the public internet and can be freely used within private networks. Network Address Translation (NAT) is used to allow devices with private addresses to communicate with the public internet.
| CIDR Block | Address Range | Total Addresses | Class |
|---|---|---|---|
| 10.0.0.0/8 | 10.0.0.0 - 10.255.255.255 | 16,777,216 | A |
| 172.16.0.0/12 | 172.16.0.0 - 172.31.255.255 | 1,048,576 | B |
| 192.168.0.0/16 | 192.168.0.0 - 192.168.255.255 | 65,536 | C |
The 10.0.0.0/8 block is the largest and is commonly used in enterprise networks and cloud environments (AWS VPCs, Azure VNets, GCP VPCs all default to addresses within this range). The 192.168.0.0/16 block is most commonly used in home networks, with 192.168.0.1 or 192.168.1.1 as the typical default gateway address for consumer routers. The 172.16.0.0/12 block is less commonly used but provides a useful middle ground with over one million addresses.
Subnetting Tips
Whether you are preparing for a networking certification (CCNA, CompTIA Network+, AWS Solutions Architect) or designing a production network, these practical tips will help you subnet effectively.
- Always plan for growth: When sizing subnets, do not allocate the bare minimum number of addresses. A subnet that perfectly fits today may be too small in six months. As a rule of thumb, plan for at least 50% more addresses than your current need. If you need 30 hosts, use a /26 (62 usable) rather than a /27 (30 usable).
- Remember the two reserved addresses: Every subnet (except /31 and /32) reserves two addresses: the network address (first address, all host bits 0) and the broadcast address (last address, all host bits 1). A /24 has 256 total addresses but only 254 usable hosts.
- Use powers of two: Subnet sizes are always powers of 2 (1, 2, 4, 8, 16, 32, 64, 128, 256, ...). If you need 100 hosts, the next power of 2 is 128 (/25 = 126 usable hosts). You cannot create a subnet of exactly 100 addresses.
- Align subnet boundaries: Subnets must start at addresses that are multiples of their size. A /26 subnet (64 addresses) can start at .0, .64, .128, or .192 within the last octet. Starting at .50 would be invalid. The network address is always evenly divisible by the subnet size.
- Use /30 for point-to-point links: Router-to-router links only need 2 usable addresses (one for each end). A /30 provides exactly 2 usable hosts and is the traditional choice. Modern networks may also use /31 (RFC 3021) which provides 2 addresses with no network or broadcast overhead.
- Use /32 for loopback and host routes: A /32 prefix identifies a single host address. It is commonly used for router loopback interfaces, host routes in routing tables, and firewall rules targeting a specific IP.
- Document your subnetting plan: Maintain a clear record of all subnet allocations, including the CIDR block, purpose, VLAN ID, gateway address, and DHCP range. Good documentation prevents address conflicts and makes troubleshooting much faster.
- Practice binary math: The fastest way to become proficient at subnetting is to practice converting between decimal, binary, and CIDR notation. Understanding the binary AND operation between an IP address and subnet mask is the key to mastering subnetting. Use the binary display in this calculator to verify your manual calculations.
- Consider VLSM for efficiency: Variable Length Subnet Masking (VLSM) allows you to use different prefix lengths for different subnets within the same network. This avoids wasting addresses by assigning large subnets to small segments. For example, use /24 for a 200-host LAN, /28 for a 10-host server VLAN, and /30 for each point-to-point link.
- Use private addresses internally: Always use RFC 1918 private address space (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) for internal networks and rely on NAT for internet access. This conserves public IP addresses and provides an additional layer of security by hiding internal network structure.