Subnet Calculator: IPv4 CIDR, Mask, Hosts and Range

Subnet Calculator

Enter any IPv4 address with a CIDR prefix or subnet mask to get the network address, broadcast, usable host range, host count, wildcard, IP class, and a full binary breakdown of the mask.

🎯Common Subnet Presets

📝Address and Mask Inputs

Any host inside the network, for example 192.168.1.10.

Used when mode is CIDR prefix.

Used when mode is dotted subnet mask, for example 255.255.255.0.

In hosts mode the smallest fitting prefix is chosen for you.

Network address 0.0.0.0 with CIDR prefix
Broadcast address 0.0.0.0 last address in block
Usable host range 0.0.0.0 first to last host
Usable hosts 0 assignable addresses

🔢Subnet Facts At A Glance

/24CIDR prefix
256Total addresses
CIP class
PrivateAddress scope

🧩Mask Octet Binary Breakdown

PartOctet 1Octet 2Octet 3Octet 4
Enter an address above to see the binary breakdown.

📊CIDR Prefix Reference

CIDRSubnet MaskWildcardTotal AddressesUsable Hosts
/20255.255.240.00.0.15.2554,0964,094
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (P2P)
/32255.255.255.2550.0.0.011 (host)

🔒Private and Reserved Ranges (RFC 1918)

RangeCIDR BlockAddress CountTypical Use
10.0.0.0 - 10.255.255.25510.0.0.0/816,777,216Large enterprise, cloud VPCs
172.16.0.0 - 172.31.255.255172.16.0.0/121,048,576Mid-size private networks
192.168.0.0 - 192.168.255.255192.168.0.0/1665,536Home and small office LANs
127.0.0.0 - 127.255.255.255127.0.0.0/816,777,216Loopback (localhost)
169.254.0.0 - 169.254.255.255169.254.0.0/1665,536Link-local (APIPA)
100.64.0.0 - 100.127.255.255100.64.0.0/104,194,304Carrier-grade NAT (RFC 6598)

🗂Splitting a /24 Into Smaller Blocks

New PrefixSubnets from /24Hosts / SubnetBlock StepFirst Two NetworksGood For
/252126128.0, .128Two even halves
/2646264.0, .64Departmental VLANs
/2783032.0, .32Small offices, Wi-Fi
/28161416.0, .16Server clusters, DMZ
/293268.0, .8Small host groups
/306424.0, .4Router point-to-point
/3112822.0, .2Modern P2P links

📋IPv4 Class and Scope Comparison

ClassFirst OctetLeading BitsDefault PrefixNetworksNotes
A1 - 1260/8126Very large blocks
B128 - 19110/1616,384Medium networks
C192 - 223110/242,097,152Small networks
D224 - 2391110n/an/aMulticast groups
E240 - 2551111n/an/aReserved, experimental
Loop1270/81Loopback localhost

How The Subnet Math Works

IP to integerEach octet is combined into one 32-bit number: ipInt = (a × 2^24) + (b × 2^16) + (c × 2^8) + d, kept unsigned.
Subnet maskThe prefix sets the leftmost bits to 1: mask = 0xFFFFFFFF shifted left by (32 - prefix). A /24 gives 255.255.255.0.
Wildcard maskThe wildcard is the bit inverse of the mask: wildcard = NOT mask. A /24 wildcard is 0.0.0.255.
Network addressBitwise AND of the host and the mask: network = ip AND mask. This is the first address in the block.
Broadcast addressBitwise OR of the network and the wildcard: broadcast = network OR wildcard. This is the last address.
Total addressesEvery host bit doubles the block: total = 2^(32 - prefix). A /26 holds 2^6 = 64 addresses.
Usable hostsRemove the network and broadcast: usable = total - 2. A /31 is a special point-to-point link with 2 usable, and a /32 is a single host.
Prefix from hostsTo fit N hosts, add 2 then round the exponent up: prefix = 32 - ceil(log2(N + 2)).

💡Practical Subnetting Tips

Sizing tip: Always plan for growth and reserve the two edge addresses. If you need 60 devices, a /26 gives 62 usable hosts, while a /27 only offers 30 and would overflow.
Point-to-point tip: Router links traditionally use a /30 with 2 usable hosts, but modern gear supports a /31 (RFC 3021) so both addresses become usable and you waste no space.

You don’t need to be a computer scientist to understand what’s happening when your home Wi-Fi seem to be buckling beneath its own weight. There is typically some kind of mess related to something called subnetting. It’s technically scary-sounding, but it simply refers to how the seemingly endless internet gets carved up into small pieces for use on your local network. So if you add a smart fridge, a laptop and a router to your house, each device require an address. Traffic jams occur when those addresses aren’t organized properley. This is where a subnet calculator stop being just math and turns into your guide for maintaining order in this chaos.

So what’s the idea? Well, a 32-bit number get split up into a network identifier and a host identifier. To think about it another way, imagine you’re setting up an address system. Your network identifier would be your street name (which identify the building). And then your host identifier would be your house/apartment number (it says exactly which apartment in that building you live in). The CIDR prefix/subnet mask defines where the cutoff point is. If you’ve ever seen a /24 used in your home router configuration, you’ll know that most folks is familiar with that kind of slash-notation. A /24 translates to a 255.255.255.0 mask, leaving 8 bits available for hosts. This equates to 256 possible addresses all told. However, only 254 of those will be usable, because you can’t use the first and last address in each block to identify the network itself or to broadcast traffic to all devices on that network.

How a Subnet Calculator Works

The above calculator does all that calculation for you and spits out results instantly, without needing to fiddle with converting your own binary string. This is also where people tend to make wrong choice when it comes to size. There’s this temptation to simply take the largest block that exists, but not only do you waste address space, you might run into routing problems if your environment get large. For example, if you’re creating a VLAN for an office of 50 people, a /26 works great because it gives you 64 total addresses while providing plenty of room to grow.

At the opposite extreme, traditional point-to-point links between routers got a /30, giving them precisely two usable hosts. Newer standards allow for using /31 prefixes on such links; basically squeezing every last drop of efficiency from the situation by getting rid of network and broadcast addresses on that single link. For security, it’s important to understand private address space as well. We call these RFC 1918 private addresses because they are all in the 192.168.x.x range. What that means is you can have millions of different homes with an address of 192.168.1.1 with no conflict because those addresses aren’t routable on the public internet. That’s why your router translates your private addresses to your public IP address when you go to a site. It’s this layering that has allowed the moddern web to function. Without it, we’d quickly run out of IPv4 addresses even more then we currently do.

The tables on the page shows which ranges are reserved and multicast. They also show exactly where private blocks belong. Looking at the binary breakout, you can see where some of the numbers make sense. Every digit position is a power of two. So the 2nd position from the right is twice the value of the 3rd position, and so on. Moving left, the value doubles. Moving from a /24 to a /23 doubles the address space from 256 to 512. This is exponential growth. And it helps visualize if you’re trying to troubleshoot why one device isn’t communicating with another. Frequently it’s because the devices are on opposite sides of the subnet boundary and there is no route set by the router between subnets.

A little forethought goes a long way when planning for expansion. What’s the smallest subnet that will do today? Run it through this tool. If you think you’ll grow again in half a year, run it again with a bigger number so you have room for future growth. Better that than being stuck with nowhere else to go. Plug different numbers into the host requirements field here and see what happens, everything changes as you change any single element. You can see the tradeoffs between capacity and efficiency in real time.

To conclude, subnetting is all about control. You can use it to organize, improve performance and increase security in a network by segmenting it. This gives you an idea of what’s going on with your infrastructure and helps you understand what mask means and how to read a CIDR value. Your job is to make the design decision, while the tools takes care of the math for you. You should of gotten this balance correct and your network will be fast, secure and able to scale. A good way to keep track is to realize that each bit matters as you divide up the digital space.

Subnet Calculator: IPv4 CIDR, Mask, Hosts and Range