Subnet Mask Calculator
Subnet Mask Calculator. Pick CIDR to Mask or Hosts to Mask in this subnet mask calculator to get the right subnet mask for your network.
Subnet Mask Reference Table
| CIDR | Subnet Mask | Wildcard Mask | Total IPs | Usable Hosts |
|---|
Enter a CIDR prefix length or specify your required number of hosts to instantly calculate the correct subnet mask in dotted-decimal, binary, and hexadecimal formats. Find the optimal mask size for your network, view usable host ranges, and convert between subnet mask notations — all in one place.
Configuring a network by hand means converting an IP address from decimal to binary, borrowing bits for subnets, and double-checking every octet before you assign a device its own slot — the Subnet Mask Calculator does that translation for you. Enter an IP address alongside a prefix or subnet mask, and you'll instantly get the network address, broadcast address, usable host range, and CIDR notation for that subnet, without manually applying the rules that the TCP/IP (Transmission Control Protocol/Internet Protocol) suite depends on. Whether you're troubleshooting a routing table or sizing a new VLAN, this tool turns a few minutes of binary math into a single lookup.
How This Subnet Mask Calculator Works
An IP subnet calculator — including this one — takes two inputs: an IP address and either a prefix or a full subnet mask, like /24 or 255.255.255.0. From there it works out every other value a network administrator needs: which bits belong to the network portion, which belong to the host portion, and everything downstream of that split.
The tool doesn't just format the total host count — it also shows the mask as a binary bitmap, so you can confirm a unique IP for every device on that subnet before you deploy it. Some sites brand this an IP calculator, others call it a netmask calculator or a network calculator; a handful bill themselves as an advanced subnet calculator because they also validate VLSM designs. A dedicated CIDR calculator or wildcard mask calculator does the same job for those specific outputs, and a free subnet calculator or online subnet calculator, in practice, mean the same thing.
Subnet Mask Basics: Bits, Octets, and Binary
A subnet mask is a 32-bit number written in the same dot-decimal notation as an IPv4 address, split into four octets. Every bit in it is either a 1 (network) or a 0 (host), and where that split falls is what a calculator like this one is really solving for. 255.255.255.0, for example, is 24 ones followed by 8 zeros: a /24, with the first three octets reserved for routing and the last one left for devices.
Converting a Subnet Mask to Binary
Take 192.168.10.0/26. A /26 borrows 2 extra subnet bits from the third octet:
$$255.255.255.192 = 11111111.11111111.11111111.11000000_2$$Those 2 borrowed bits create \(2^2 = 4\) subnets, each with \(2^6 - 2 = 62\) usable addresses — exactly what a subnet calculator returns the instant you enter the prefix, instead of making you count by hand.
IP Subnet Calculator Output: CIDR Notation and Prefix Length
CIDR notation (Classless Inter-Domain Routing) is the shorthand every modern IP subnet calculator uses instead of a full dot-decimal mask: a forward slash followed by the prefix length. /24 and 255.255.255.0 describe the exact same value — CIDR notation is just faster to type and easier to compare at a glance. Before CIDR replaced classful addressing in the 1990s, routers had to infer the network portion of an address purely from its class; today, that information travels explicitly alongside the address itself. The opposite move — combining several smaller blocks into one larger supernet — is called supernetting, and it's why an ISP can advertise a single route instead of dozens.
Network Class A, B, and C
Before CIDR, every IP address belonged to a fixed network class, and legacy documentation — plus a good chunk of certification material — still uses the terminology. Class A addresses (1–126 in the first octet) reserve just 8 bits for routing and leave 24 for devices, which is why a single Class A block can hold over 16 million addresses. Class B (128–191) splits 16 bits each way, and Class C (192–223) reserves 24, leaving only 254 usable spots per subnet — the default most home and small-office networks still use today.
In practice, most home and office equipment ships with private, non-routable defaults that trace back to that same numbering — 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are the three ranges most consumer routers use out of the box. None of those are reachable directly from the public internet, which is exactly the point: they're free to reuse behind a router on any private network without colliding with anyone else's.
Finding the Network and Broadcast Addresses
Once the calculator knows your prefix, it can derive three more values without any extra input. The network address is the first entry in the subnet — every host bit set to 0 — and identifies the subnet itself rather than any single device on it. The broadcast address is the mirror image, used to reach every device on that segment at once. Between those two boundaries sits the usable host range:
$$\text{Usable Hosts} = 2^{(32 - \text{Prefix Length})} - 2$$The -2 accounts for those two reserved values themselves, which is why a /30 (4 total spots) yields only 2 usable hosts, while a /24 (256 total spots) yields 254.
Usable Host Address Range Example
For 10.0.0.0/28, the usable host address range runs from 10.0.0.1 to 10.0.0.14, with the two endpoints reserved for network identification and broadcast delivery.
Wildcard Masks, Network Masks, and Access Control Lists
A wildcard mask is the inverse of a subnet mask — every 0 becomes a 1 and every 1 becomes a 0. Where a network mask of 255.255.255.0 says "match the first three octets exactly," its inverted equivalent, 0.0.0.255, says "the last one can be anything." That inversion is exactly what access control lists (ACLs) and OSPF configurations expect: routers built their permit/deny logic and their routing-table matching around it decades before dot-decimal notation became the default for endpoint configuration.
IPv4 vs IPv6 Subnetting
An IPv4 subnet calculator works with a 32-bit space — 232, or about 4.3 billion values — split across two portions using the math above. IPv6 addresses are 128 bits, written in hexadecimal instead of dot-decimal notation, and largely drops the subnet mask concept in favor of a prefix alone, since classless routing was built in from the start rather than retrofitted on. Most IPv6 deployments still use a /64 prefix for every subnet, leaving 64 bits for the host identifier portion — vastly more than any network will ever need, by design.
Host Identifier and Routing Prefix in IPv6
In IPv6 addressing, the routing prefix (the network portion) and the host identifier (formerly the "rest field" in early IPv4 specs) usually split exactly at the 64-bit mark. A network interface typically derives its own identifier automatically from its hardware address rather than manual assignment — one more thing a calculator can't do for you, though it can still tell you which /64 block that device belongs to.
Subnet Mask Cheat Sheet
The table below covers the values you'll run into most often, from a full Class A block down to the smallest usable subnet. Pair any row's prefix with the IP address in the calculator above for an instant breakdown, or use it as a quick reference when you already know the math.
| CIDR / Prefix | Subnet Mask | Wildcard Mask | Usable Hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,214 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,534 |
| /24 | 255.255.255.0 | 0.0.0.255 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 2 |
Why Subnetting Matters for Network Design
Subnetting isn't just an exam topic — it's core to networking and IP addressing, and it's how an IT professional or a network engineer actually builds a network. A flat setup with thousands of devices on one broadcast domain is slow and hard to secure and makes network troubleshooting painful, since a single misbehaving card can affect everyone at once. Splitting a large private network into smaller subnets keeps that traffic contained, lets you apply different firewall and ACL rules per segment, and makes routing tables easier to read. This kind of network subnetting also shows up constantly on CompTIA Network+ and CCNA certification exams, precisely because it's the skill those roles use daily.
IT professionals and network administrators lean on a subnet calculator across networks of every size, not just for exams:
- Sizing DHCP scopes so every new device on a segment gets an address automatically.
- Tracking allocations with dedicated IP address management software once a deployment outgrows a spreadsheet.
- Confirming the correct network prefix before updating a static route.
- Working out mask bits by hand during a CCNA or CompTIA Network+ study session.
- Documenting which spare spots are set aside for future growth.
Using the Calculator to Troubleshoot Connectivity
A classic scenario: two systems on the same switch can't ping each other, and nobody's sure why. Punch each one's configuration into the calculator, compare the resulting boundaries, and you'll usually spot the problem in seconds — one endpoint is set to a /24 while the other expects a /25, so they land in different segments even though the first three octets look identical at a glance. The same check catches a mismatched default gateway, a DHCP scope that overlaps a statically assigned range, or a VLAN tagged with the wrong value during a switch migration. None of it requires redoing the math by hand on the spot; it just means knowing which two numbers to compare.
Common Subnetting Mistakes to Avoid
The most frequent error is an off-by-one on the reserved values — treating the first or last spot in a segment as available for a device when it's actually set aside for identification or delivery. A close second is comparing two configurations without converting both to the same format first: a /26 and 255.255.255.192 are the same thing, but they don't look alike side by side, and it's easy to misjudge whether two devices actually belong together. Teams that skip VLSM also tend to run out of segments faster than expected, because splitting everything into identical-sized blocks wastes far more capacity than sizing each one to its actual team. And on the ACL side, forgetting that the values are inverted is a common source of rules that accidentally match — or block — far more traffic than intended.
A Practical VLSM Example
Say you're handed 192.168.1.0/24 and need to split it across four teams of different sizes: Engineering (50), Sales (25), Support (10), and a point-to-point link (2). Carving the block into four equal /26 subnets would waste addresses on the smaller teams, so variable length subnet masking (VLSM) sizes each one to 62, 30, 14, and 2 usable spots respectively:
- Engineering — 192.168.1.0/26
- Sales — 192.168.1.64/27
- Support — 192.168.1.96/28
- Point-to-point link — 192.168.1.112/30
That's exactly the kind of design a network mask calculator checks for you: confirming that none of the four ranges overlap and that each block starts on a valid boundary for its size — the sort of check that also matters when a public IP block from an ISP needs to be split among several customers instead of kept as one large network number.
Advanced IPv6 Concepts: 6to4, Reverse DNS, and Multicasting
A few IPv6 features don't have a direct IPv4 equivalent. An ipv4 mapped address embeds a full 32-bit IPv4 value inside a 128-bit IPv6 one so dual-stack devices can reach IPv4-only hosts without separate translation, while a 6to4 prefix tunnels IPv6 traffic across an IPv4-only network without a dedicated gateway. IPv6 also replaces the broadcast model with multicasting, so traffic reaches only the devices that joined a specific group. And when you only have an address and need a hostname, a reverse DNS lookup — an in-addr.arpa record for IPv4, or its IPv6 equivalent — maps it back for you.
Manual subnetting comes down to a few repeatable steps, the same ones this calculator runs internally:
- Write the configuration side by side in binary.
- Decide how many bits to borrow for your subnets.
- Apply a bitwise AND to work out the two reserved values for each block.
- Divide what's left evenly — or unevenly, with VLSM — to match your team sizes.
Run through it by hand a couple of times and a subnet calculator stops feeling like a black box; it's just consistent arithmetic, applied every time you hand out a new IP, whether it sits on a public network or stays behind a router on a private one.
Related Network Tools
Explore these related tools for subnet calculation and IP address management.
Additional networking calculators for IP address planning and network analysis.
More tools to support network design, addressing, and subnet troubleshooting.
Comments & Feedback
Share your experience or ask questions about this tool