IP Subnet Calculator
Calculate subnet masks, network addresses, broadcast addresses, and host ranges. Supports IPv4 CIDR notation and provides a detailed subnet breakdown with export functionality.
| # | Network Address | Usable Host Range | Broadcast | Hosts | CIDR |
|---|
| CIDR | Subnet Mask | Wildcard Mask | Total IPs | Usable Hosts | Class |
|---|
IP Subnet Calculator: Network Address, Mask & Host Range Instantly
This ip subnet calculator takes an IP address + CIDR prefix or subnet mask and produces the network address, broadcast address, usable host range, total usable hosts and wildcard mask instantaneously. Enter CIDR or dotted-decimal format and this ip subnetting calculator online does the arithmetic instantly in your browser.
Most IP subnet calculator simply give you the answer without telling you the logic. Here’s a step-by-step walkthrough of the actual binary math so you understand exactly how the numbers are formed, not simply what they are.
What Is Subnetting? (Quick Refresher)
Subnetting is the division of a larger network into smaller, more manageable sub-networks. How? You borrow bits from the host part of an IP address and reassign them to the network part.
Every IPv4 address is essentially two parts smashed together. A network part (whatever network a device belongs to) and a host part (which specific device on that network). Subnetting alters the division between the two components providing smaller networks that are easier to organize, secure, and route data between. This is important for anything from a tiny office network to a data center. It keeps broadcast traffic controlled and makes address allocation significantly more efficient than one huge flat network, which is what an IP subnet calculator does.
How an IP Subnet Mask Works (CIDR Notation Explained)
The term CIDR (Classless Inter-Domain Routing) just tells you how many bits of an IP address calculator are used for the network part with the help of an IP subnet calculator. If you see an address like 192.168.1.0/24, the “/24” part means that the first 24 bits are the network part and the rest (8 bits in this case) are for guests.
This idea of an IP subnet calculator is the same as a subnet mask written in dotted-decimal format. What a /24 prefix and a 255.255.255.0 subnet mask really mean is the same thing, but written in two different ways:
CIDR | Subnet Mask (Decimal) |
/24 | 255.255.255.0 |
/25 | 255.255.255.128 |
/26 | 255.255.255.192 |
The wildcard mask is just the opposite of the subnet mask. The ip subnet mask calculator has a 0 where the subnet mask has a 255 and vice versa. It’s 255.255.255.0 for a /24 network, so 0.0.0.255 is the wildcard mask. These masks are most often used in access control lists (ACLs) on routers and firewalls.
How to Calculate a Subnet: Full Binary Walk-Through
We’ll use 192.168.1.0/26 as an example and go through it from beginning to end.
Step 1: Identify which octet the subnetting happens in. For the network part, a /26 tag means that 26 bits are used. The first three octets, or 24 bits, are all network bits, since 192.168.1 takes up 24 of the 26 bits. Two more network bits can be taken from the fourth octet.
Step 2: Write out the /26 mask in binary.
111111111.11111111.11111111.11000000
Take a look at the last eight bits: 11000000. The network borrows the first two bits, which is how /26 gets its extra two bits over /24. The hosts are left with the remaining six bits.
Step 3: Calculate the block size. Since there are still 6 host bits to go, the block size (the number of addresses in each group) is 2^6 = 64. In this /26 scheme, that means that each subnet block covers 64 addresses.
Step 4: Identify the network address, broadcast address, and usable range.
Decimal | Last Octet in Binary | |
Network address | 192.168.1.0 | 0 |
First usable host | 192.168.1.1 | 1 |
Last usable host | 192.168.1.62 | 111110 |
Broadcast address | 192.168.1.63 | 111111 |
With all host bits set to 0, the network address (192.168.1.0) is always the first address in the block. All host bits are set to 1 at the broadcast address (192.168.1.63), which is always the last address in the block. From 192.168.1.1 to 192.168.1.62, which is everything in between, you can use for real devices. This gives you 62 useful hosts (64 total addresses, minus the network and broadcast addresses).
That’s how every ip subnet calculator works: find out how many host bits are left, use that number to figure out the block size, and the network and broadcast addresses will be the first and last addresses in that block.
Quick CIDR Reference Table (/24 to /30)
Here is a complete lookup table for the most commonly used CIDR prefixes, from /24 down to /30:
CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts |
/24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
/25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
/26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
/27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
/28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
/29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
/30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
Take note of the pattern: each step down (a bigger start number) borrows one more bit, which cuts the number of addresses in half. From full LAN segments (/24) to point-to-point links (/30), this table shows the range of subnets you’ll use for most real-world jobs.
VLSM: Subnetting Networks of Different Sizes
It is easy to divide a network into subnets of similar size, but real networks don’t usually need pieces of the same size. What VLSM (Variable-Length Subnet Masking) does is help with that. VLSM doesn’t make all subnets the same size; instead, it lets you set the size of each subnet to match the exact number of hosts it needs. This way, addresses aren’t wasted on subnets that don’t need them.
You have one 192.168.1.0/24 block and need to make three subnets. One subnet needs up to 100 hosts, another needs up to 50 hosts, and the third needs up to 20 hosts.
Subnet Need | CIDR Assigned | Address Range | Usable Hosts |
Up to 100 hosts | /25 | 192.168.1.0 – 192.168.1.127 | 126 |
Up to 50 hosts | /26 | 192.168.1.128 – 192.168.1.191 | 62 |
Up to 20 hosts | /27 | 192.168.1.192 – 192.168.1.223 | 30 |
You make good use of the address space (192.168.1.224/27) by giving /25, /26, and /27 based on what you need instead of breaking up the whole /24 into equal chunks. This leaves room for future growth.
Common Subnetting Mistakes
A few errors come up constantly, even among experienced network techs:
- Forgetting to subtract the network and broadcast addresses. A /24 has 256 total addresses, but only 254 are usable, since the first and last are reserved.
- Confusing the CIDR prefix with host count directly. A smaller number after the slash (like /8) means a much bigger network, not a smaller one, since fewer bits are used for the network portion.
- Overlapping subnet ranges. When manually allocating VLSM subnets, it’s easy to accidentally reuse address space that’s already assigned to another subnet.
- Miscounting borrowed bits when converting between formats. Going from a subnet mask to CIDR (or back) means carefully counting consecutive 1-bits, and it’s easy to lose track by one bit, which throws off the entire calculation.
Frequently Asked Questions
Q1. How do I calculate the network address from an IP and subnet mask?
Do a binary AND of the IP subnet calculator mask. The matching bit from the IP address calculator is kept where the subnet mask has a 1 and is 0 where it has a 0. The net address is left. In our /26 example we end up with 192.168.1.0.
Q2. How many usable hosts are in a /24 network?
A /24 has 256 total addresses, but the first address is used as the network address and the last address is used as the broadcast address thus you are left with 254 acceptable addresses for hosts.
Q3. What’s the difference between a subnet mask and a wildcard mask?
They are reciprocals of each other. 255 in the subnet mask then the wildcard mask is 0 and vice versa. The subnet mask of a /24 network is 255.255.255.0, and the wildcard mask is 0.0.0.255.
Q4. What is VLSM and why is it used?
VLSM (Variable-Length Subnet Masking) allows you to create varied-size subnets in the same block of addresses dependent on the number of hosts that need to be connected to each subnet rather than each subnet being the same size. This prevents address space from being wasted on subnets that do not need it.
Q5. How do I convert a subnet mask to CIDR notation?
Count the number of consecutive 1-bits in the binary form of the subnet mask. For example, 255.255.255.192 in binary is 11111111.11111111.11111111.11000000, which contains 26 consecutive 1-bits hence it transforms to /26.
Q6. Why do I subtract 2 from the total addresses to get usable hosts?
This is because the first address in a subnet block is always reserved as the network address and the last address is always reserved as the broadcast address. They cannot be assigned to a real device so they are removed from the total to get the usable host count.
Conclusion
It looks scary until you see the binary math step by step and then, when it clicks, it clicks. In this ip subnet calculator tool all network address broadcast addresses, and usable host ranges are all based on the same reasoning as demonstrated in the above walkthrough: get the block size work out the host bits, and the rest is easy. Use the IP subnet calculator at the top of this page for your own address and prefix and keep the CIDR reference table ready for quick lookups as you work.
